From d65ef3cd7c45b111402dd122c38463f18669763c Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Thu, 27 Jun 2024 22:00:27 +0800 Subject: [PATCH] :zap: Refactor the blocktree storage https://github.com/siyuan-note/siyuan/issues/11773 --- kernel/treenode/av.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/kernel/treenode/av.go b/kernel/treenode/av.go index 6fd0e1720..d07721c1a 100644 --- a/kernel/treenode/av.go +++ b/kernel/treenode/av.go @@ -49,10 +49,9 @@ func GetMirrorAttrViewBlockIDs(avID string) (ret []string) { } blockIDs := avBlocks[avID] - for _, blockID := range blockIDs { - if nil != GetBlockTree(blockID) { - ret = append(ret, blockID) - } + bts := GetBlockTrees(blockIDs) + for blockID := range bts { + ret = append(ret, blockID) } return } @@ -87,11 +86,8 @@ func BatchGetMirrorAttrViewBlocks(avIDs []string) (ret []*AvBlock) { for _, avID := range avIDs { var blockIDs []string - for _, blockID := range avBlocks[avID] { - if nil == GetBlockTree(blockID) { - continue - } - + bts := GetBlockTrees(avBlocks[avID]) + for blockID := range bts { blockIDs = append(blockIDs, blockID) } avBlock := &AvBlock{