From e05ad77aef21d8591df7883bd10285cfc27e98bc Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 2 Feb 2023 14:44:19 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E7=A7=BB=E5=8A=A8=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E5=90=8E=E6=89=93=E5=BC=80=E6=96=87=E6=A1=A3=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E5=8A=A8=E6=80=81=E5=8A=A0=E8=BD=BD=E5=90=8E?= =?UTF-8?q?=E4=BC=9A=E5=85=B3=E9=97=AD=E9=A1=B5=E7=AD=BE=20Fix=20https://g?= =?UTF-8?q?ithub.com/siyuan-note/siyuan/issues/7231?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/treenode/blocktree.go | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/kernel/treenode/blocktree.go b/kernel/treenode/blocktree.go index 8aa62649e..01b98b81c 100644 --- a/kernel/treenode/blocktree.go +++ b/kernel/treenode/blocktree.go @@ -147,26 +147,8 @@ func GetBlockTree(id string) (ret *BlockTree) { } func SetBlockTreePath(tree *parse.Tree) { - hash := btHash(tree.ID) - val, ok := blockTrees.Load(hash) - if !ok { - val = &btSlice{data: map[string]*BlockTree{}, changed: time.Time{}, m: &sync.Mutex{}} - blockTrees.Store(hash, val) - } - - slice := val.(*btSlice) - slice.m.Lock() - slice.data[tree.ID] = &BlockTree{ - ID: tree.ID, - RootID: tree.Root.ID, - BoxID: tree.Box, - Path: tree.Path, - HPath: tree.HPath, - Updated: tree.Root.IALAttr("updated"), - Type: TypeAbbr(ast.NodeDocument.String()), - } - slice.m.Unlock() - slice.changed = time.Now() + RemoveBlockTreesByRootID(tree.ID) + IndexBlockTree(tree) } func RemoveBlockTreesByRootID(rootID string) { @@ -176,7 +158,7 @@ func RemoveBlockTreesByRootID(rootID string) { slice.m.Lock() for _, b := range slice.data { if b.RootID == rootID { - ids = append(ids, b.RootID) + ids = append(ids, b.ID) } } slice.m.Unlock()