From 43867e085558799f191abca5732daaefa053d3cc Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sat, 7 Sep 2024 12:05:56 +0800 Subject: [PATCH] :art: Improve dynamic anchor text and ref count auto-refresh stability https://github.com/siyuan-note/siyuan/issues/8234 --- kernel/model/transaction.go | 3 ++- kernel/util/websocket.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go index 00d3af40f..7fb88da05 100644 --- a/kernel/model/transaction.go +++ b/kernel/model/transaction.go @@ -1250,7 +1250,8 @@ func pushSetDefRefCount(rootID, blockID string) { for _, count := range refCounts { rootRefCount += count } - util.PushSetDefRefCount(rootID, blockID, refCount, rootRefCount) + refIDs, _, _ := GetBlockRefIDs(blockID) + util.PushSetDefRefCount(rootID, blockID, refIDs, refCount, rootRefCount) } func upsertAvBlockRel(node *ast.Node) { diff --git a/kernel/util/websocket.go b/kernel/util/websocket.go index 8ca88f3e7..8ac67673e 100644 --- a/kernel/util/websocket.go +++ b/kernel/util/websocket.go @@ -262,8 +262,8 @@ func PushSetRefDynamicText(rootID, blockID, defBlockID, refText string) { BroadcastByType("main", "setRefDynamicText", 0, "", map[string]interface{}{"rootID": rootID, "blockID": blockID, "defBlockID": defBlockID, "refText": refText}) } -func PushSetDefRefCount(rootID, blockID string, refCount, rootRefCount int) { - BroadcastByType("main", "setDefRefCount", 0, "", map[string]interface{}{"rootID": rootID, "blockID": blockID, "refCount": refCount, "rootRefCount": rootRefCount}) +func PushSetDefRefCount(rootID, blockID string, refIDs []string, refCount, rootRefCount int) { + BroadcastByType("main", "setDefRefCount", 0, "", map[string]interface{}{"rootID": rootID, "blockID": blockID, "refCount": refCount, "rootRefCount": rootRefCount, "refIDs": refIDs}) } func PushProtyleLoading(rootID, msg string) {