🧑‍💻 Improve kernel API /api/block/updateBlock and /api/block/batchUpdateBlock https://github.com/siyuan-note/siyuan/issues/15301

This commit is contained in:
Daniel 2025-07-16 00:05:51 +08:00
parent 70e31c71cc
commit 56a5f13728
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
5 changed files with 66 additions and 140 deletions

View file

@ -207,6 +207,17 @@ func LoadTreeByBlockIDWithReindex(id string) (ret *parse.Tree, err error) {
return
}
func LoadTreeWithCache(id string, treeCache *map[string]*parse.Tree) (tree *parse.Tree, err error) {
if tree = (*treeCache)[id]; nil != tree {
return
}
tree, err = LoadTreeByBlockID(id)
if nil == err && nil != tree {
(*treeCache)[id] = tree
}
return
}
func LoadTreeByBlockID(id string) (ret *parse.Tree, err error) {
if !ast.IsNodeIDPattern(id) {
stack := logging.ShortStack()