mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
⚡ Improve load tree performance
This commit is contained in:
parent
cb16111314
commit
1452e7cf3f
3 changed files with 19 additions and 22 deletions
|
|
@ -557,11 +557,16 @@ func (box *Box) UpdateHistoryGenerated() {
|
|||
|
||||
func getBoxesByPaths(paths []string) (ret map[string]*Box) {
|
||||
ret = map[string]*Box{}
|
||||
var ids []string
|
||||
for _, p := range paths {
|
||||
id := strings.TrimSuffix(path.Base(p), ".sy")
|
||||
bt := treenode.GetBlockTree(id)
|
||||
ids = append(ids, strings.TrimSuffix(path.Base(p), ".sy"))
|
||||
}
|
||||
|
||||
bts := treenode.GetBlockTrees(ids)
|
||||
for _, id := range ids {
|
||||
bt := bts[id]
|
||||
if nil != bt {
|
||||
ret[p] = Conf.Box(bt.BoxID)
|
||||
ret[bt.Path] = Conf.Box(bt.BoxID)
|
||||
}
|
||||
}
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue