Skip to content

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

:art: Improve dynamic anchor text auto-refresh stability https://github.com/siyuan-note/siyuan/issues/8234

Daniel1ff69fa25795
diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go
index 08b805daf2..7fa049aa6a 100644
--- a/kernel/model/transaction.go
+++ b/kernel/model/transaction.go
@@ -40,6 +40,7 @@ import (
"github.com/siyuan-note/siyuan/kernel/cache"
"github.com/siyuan-note/siyuan/kernel/filesys"
"github.com/siyuan-note/siyuan/kernel/sql"
+ "github.com/siyuan-note/siyuan/kernel/task"
"github.com/siyuan-note/siyuan/kernel/treenode"
"github.com/siyuan-note/siyuan/kernel/util"
)
@@ -1488,7 +1489,7 @@ func refreshDynamicRefTexts(updatedDefNodes map[string]*ast.Node, updatedTrees m
}
// 推送动态锚文本节点刷新
- util.PushReloadBlock(refTreeID, n.ID)
+ task.AppendAsyncTaskWithDelay(task.ReloadProtyleBlock, 200*time.Millisecond, util.PushReloadBlock, refTreeID, n.ID)
return ast.WalkContinue
}
return ast.WalkContinue
diff --git a/kernel/task/queue.go b/kernel/task/queue.go
index db339e5ea3..0cb7a87c12 100644
--- a/kernel/task/queue.go
+++ b/kernel/task/queue.go
@@ -134,6 +134,7 @@ const (
AssetContentDatabaseIndexCommit = "task.asset.database.index.commit" // 资源文件数据库索引提交
CacheVirtualBlockRef = "task.cache.virtualBlockRef" // 缓存虚拟块引用
ReloadAttributeView = "task.reload.attributeView" // 重新加载属性视图
+ ReloadProtyleBlock = "task.reload.protyleBlock" // 重载编辑器内容块
PushMsg = "task.push.msg" // 推送消息
)
@@ -149,6 +150,7 @@ var uniqueActions = []string{
AssetContentDatabaseIndexFull,
AssetContentDatabaseIndexCommit,
ReloadAttributeView,
+ ReloadProtyleBlock,
}
func ContainIndexTask() bool {