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

Daniel1f30848d8d7c
diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go
index dbb2bf422b..cdcc3aa92e 100644
--- a/kernel/model/transaction.go
+++ b/kernel/model/transaction.go
@@ -1487,7 +1487,7 @@ func refreshDynamicRefTexts(updatedDefNodes map[string]*ast.Node, updatedTrees m
// 推送动态锚文本节点刷新
for _, defNode := range changedDefNodes {
- task.AppendAsyncTaskWithDelay(task.ReloadProtyleBlock, 200*time.Millisecond, util.PushReloadBlock, refTreeID, n.ID, defNode.id, defNode.refText)
+ task.AppendAsyncTaskWithDelay(task.SetRefDynamicText, 200*time.Millisecond, util.PushSetRefDynamicText, refTreeID, n.ID, defNode.id, defNode.refText)
}
return ast.WalkContinue
}
diff --git a/kernel/task/queue.go b/kernel/task/queue.go
index 0cb7a87c12..b9f5099fa4 100644
--- a/kernel/task/queue.go
+++ b/kernel/task/queue.go
@@ -134,7 +134,8 @@ const (
AssetContentDatabaseIndexCommit = "task.asset.database.index.commit" // 资源文件数据库索引提交
CacheVirtualBlockRef = "task.cache.virtualBlockRef" // 缓存虚拟块引用
ReloadAttributeView = "task.reload.attributeView" // 重新加载属性视图
- ReloadProtyleBlock = "task.reload.protyleBlock" // 重载编辑器内容块
+ SetRefDynamicText = "task.ref.setDynamicText" // 设置引用的动态锚文本
+ SetDefRefCount = "task.def.setRefCount" // 设置定义的引用计数
PushMsg = "task.push.msg" // 推送消息
)
@@ -150,7 +151,8 @@ var uniqueActions = []string{
AssetContentDatabaseIndexFull,
AssetContentDatabaseIndexCommit,
ReloadAttributeView,
- ReloadProtyleBlock,
+ SetRefDynamicText,
+ SetDefRefCount,
}
func ContainIndexTask() bool {
diff --git a/kernel/util/websocket.go b/kernel/util/websocket.go
index 5d52116aab..ee5792a13a 100644
--- a/kernel/util/websocket.go
+++ b/kernel/util/websocket.go
@@ -258,8 +258,8 @@ func PushProtyleReload(rootID string) {
BroadcastByType("protyle", "reload", 0, "", rootID)
}
-func PushReloadBlock(rootID, blockID, defBlockID, refText string) {
- BroadcastByType("protyle", "reloadBlock", 0, "", map[string]interface{}{"rootID": rootID, "blockID": blockID, "defBlockID": defBlockID, "refText": refText})
+func PushSetRefDynamicText(rootID, blockID, defBlockID, refText string) {
+ BroadcastByType("protyle", "setRefDynamicText", 0, "", map[string]interface{}{"rootID": rootID, "blockID": blockID, "defBlockID": defBlockID, "refText": refText})
}
func PushProtyleLoading(rootID, msg string) {