🐛 移动文档后打开文档滚动触发动态加载后会关闭页签 Fix https://github.com/siyuan-note/siyuan/issues/7231

This commit is contained in:
Liang Ding 2023-02-02 14:44:19 +08:00
parent 4ae9fda611
commit e05ad77aef
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -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()