mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 Improve dynamic anchor text auto-refresh stability https://github.com/siyuan-note/siyuan/issues/8234
This commit is contained in:
parent
c33401ed7c
commit
fa3abe615e
2 changed files with 13 additions and 4 deletions
|
|
@ -1231,9 +1231,18 @@ func getRefDefIDs(node *ast.Node) (refDefIDs []string) {
|
||||||
func pushSetDefRefCount(rootID, blockID string) {
|
func pushSetDefRefCount(rootID, blockID string) {
|
||||||
sql.WaitForWritingDatabase()
|
sql.WaitForWritingDatabase()
|
||||||
|
|
||||||
refCounts := sql.QueryRefCount([]string{blockID})
|
bt := treenode.GetBlockTree(blockID)
|
||||||
|
if nil == bt {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
refCounts := sql.QueryRootChildrenRefCount(bt.RootID)
|
||||||
refCount := refCounts[blockID]
|
refCount := refCounts[blockID]
|
||||||
util.PushSetDefRefCount(rootID, blockID, refCount)
|
var rootRefCount int
|
||||||
|
for _, count := range refCounts {
|
||||||
|
rootRefCount += count
|
||||||
|
}
|
||||||
|
util.PushSetDefRefCount(rootID, blockID, refCount, rootRefCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
func upsertAvBlockRel(node *ast.Node) {
|
func upsertAvBlockRel(node *ast.Node) {
|
||||||
|
|
|
||||||
|
|
@ -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})
|
BroadcastByType("main", "setRefDynamicText", 0, "", map[string]interface{}{"rootID": rootID, "blockID": blockID, "defBlockID": defBlockID, "refText": refText})
|
||||||
}
|
}
|
||||||
|
|
||||||
func PushSetDefRefCount(rootID, blockID string, refCount int) {
|
func PushSetDefRefCount(rootID, blockID string, refCount, rootRefCount int) {
|
||||||
BroadcastByType("main", "setDefRefCount", 0, "", map[string]interface{}{"rootID": rootID, "blockID": blockID, "refCount": refCount})
|
BroadcastByType("main", "setDefRefCount", 0, "", map[string]interface{}{"rootID": rootID, "blockID": blockID, "refCount": refCount, "rootRefCount": rootRefCount})
|
||||||
}
|
}
|
||||||
|
|
||||||
func PushProtyleLoading(rootID, msg string) {
|
func PushProtyleLoading(rootID, msg string) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue