Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:zap: Refactor the blocktree storage https://github.com/siyuan-note/siyuan/issues/11773

Danield65ef3cd7c45
diff --git a/kernel/treenode/av.go b/kernel/treenode/av.go
index 6fd0e1720b..d07721c1a5 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{