Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: https://github.com/siyuan-note/siyuan/issues/13230

Vanessa8a6ba2b2d084
diff --git a/app/src/layout/dock/Backlink.ts b/app/src/layout/dock/Backlink.ts
index 025b81383f..3d73f49acd 100644
--- a/app/src/layout/dock/Backlink.ts
+++ b/app/src/layout/dock/Backlink.ts
@@ -462,10 +462,10 @@ export class Backlink extends Model {
}
public refresh() {
- if (!this.blockId) {
+ const element = this.element.querySelector('.block__icon[data-type="refresh"] svg');
+ if (!this.blockId || element.classList.contains("fn__rotate")) {
return;
}
- const element = this.element.querySelector('.block__icon[data-type="refresh"] svg');
element.classList.add("fn__rotate");
fetchPost("/api/ref/refreshBacklink", {
id: this.blockId,
diff --git a/app/src/protyle/index.ts b/app/src/protyle/index.ts
index 730ced09f1..0671653eb1 100644
--- a/app/src/protyle/index.ts
+++ b/app/src/protyle/index.ts
@@ -126,24 +126,24 @@ export class Protyle {
}
break;
case "transactions":
- if (options.backlinkData) {
- getAllModels().backlink.find(item => {
- if (item.element.contains(this.protyle.element)) {
- item.refresh();
- return true;
- }
- });
- } else {
- data.data[0].doOperations.forEach((item: IOperation) => {
- if (!this.protyle.preview.element.classList.contains("fn__none") &&
- item.action !== "updateAttrs" // 预览模式下点击只读
- ) {
- this.protyle.preview.render(this.protyle);
- } else {
- onTransaction(this.protyle, item, false);
- }
- });
- }
+ data.data[0].doOperations.find((item: IOperation) => {
+ if (!this.protyle.preview.element.classList.contains("fn__none") &&
+ item.action !== "updateAttrs" // 预览模式下点击只读
+ ) {
+ this.protyle.preview.render(this.protyle);
+ } else if (options.backlinkData && ["delete", "move"].includes(item.action)) {
+ // 只对特定情况刷新,否则展开、编辑等操作刷新会频繁
+ getAllModels().backlink.find(backlinkItem => {
+ if (backlinkItem.element.contains(this.protyle.element)) {
+ backlinkItem.refresh();
+ return true;
+ }
+ });
+ return true;
+ } else {
+ onTransaction(this.protyle, item, false);
+ }
+ });
break;
case "readonly":
window.siyuan.config.editor.readOnly = data.data;