Skip to content

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

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

Daniel43867e085558
diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go
index 00d3af40f9..7fb88da054 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 8ca88f3e75..8ac67673ea 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) {