Browse Source

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

Daniel 10 tháng trước cách đây
mục cha
commit
1f30848d8d

+ 1 - 1
kernel/model/transaction.go

@@ -1487,7 +1487,7 @@ func refreshDynamicRefTexts(updatedDefNodes map[string]*ast.Node, updatedTrees m
 
 
 				// 推送动态锚文本节点刷新
 				// 推送动态锚文本节点刷新
 				for _, defNode := range changedDefNodes {
 				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
 				return ast.WalkContinue
 			}
 			}

+ 4 - 2
kernel/task/queue.go

@@ -134,7 +134,8 @@ const (
 	AssetContentDatabaseIndexCommit = "task.asset.database.index.commit"   // 资源文件数据库索引提交
 	AssetContentDatabaseIndexCommit = "task.asset.database.index.commit"   // 资源文件数据库索引提交
 	CacheVirtualBlockRef            = "task.cache.virtualBlockRef"         // 缓存虚拟块引用
 	CacheVirtualBlockRef            = "task.cache.virtualBlockRef"         // 缓存虚拟块引用
 	ReloadAttributeView             = "task.reload.attributeView"          // 重新加载属性视图
 	ReloadAttributeView             = "task.reload.attributeView"          // 重新加载属性视图
-	ReloadProtyleBlock              = "task.reload.protyleBlock"           // 重载编辑器内容块
+	SetRefDynamicText               = "task.ref.setDynamicText"            // 设置引用的动态锚文本
+	SetDefRefCount                  = "task.def.setRefCount"               // 设置定义的引用计数
 	PushMsg                         = "task.push.msg"                      // 推送消息
 	PushMsg                         = "task.push.msg"                      // 推送消息
 )
 )
 
 
@@ -150,7 +151,8 @@ var uniqueActions = []string{
 	AssetContentDatabaseIndexFull,
 	AssetContentDatabaseIndexFull,
 	AssetContentDatabaseIndexCommit,
 	AssetContentDatabaseIndexCommit,
 	ReloadAttributeView,
 	ReloadAttributeView,
-	ReloadProtyleBlock,
+	SetRefDynamicText,
+	SetDefRefCount,
 }
 }
 
 
 func ContainIndexTask() bool {
 func ContainIndexTask() bool {

+ 2 - 2
kernel/util/websocket.go

@@ -258,8 +258,8 @@ func PushProtyleReload(rootID string) {
 	BroadcastByType("protyle", "reload", 0, "", rootID)
 	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) {
 func PushProtyleLoading(rootID, msg string) {