mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-02 06:48:49 +01:00
⚡ Optimize the performance of document tree flashcard loading Fix https://github.com/siyuan-note/siyuan/issues/7967
This commit is contained in:
parent
f30e9893e8
commit
758f65fdff
2 changed files with 18 additions and 27 deletions
|
|
@ -180,6 +180,21 @@ func RemoveBlockTreesByRootID(rootID string) {
|
|||
}
|
||||
}
|
||||
|
||||
func GetBlockTreesByPathPrefix(pathPrefix string) (ret []*BlockTree) {
|
||||
blockTrees.Range(func(key, value interface{}) bool {
|
||||
slice := value.(*btSlice)
|
||||
slice.m.Lock()
|
||||
for _, b := range slice.data {
|
||||
if strings.HasPrefix(b.Path, pathPrefix) {
|
||||
ret = append(ret, b)
|
||||
}
|
||||
}
|
||||
slice.m.Unlock()
|
||||
return true
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func RemoveBlockTreesByPathPrefix(pathPrefix string) {
|
||||
var ids []string
|
||||
blockTrees.Range(func(key, value interface{}) bool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue