Skip to content

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

:art: Improve database block remove https://github.com/siyuan-note/siyuan/issues/11731

Daniele99852f0675e
diff --git a/kernel/model/file.go b/kernel/model/file.go
index 56ff363460..ffb20a41ac 100644
--- a/kernel/model/file.go
+++ b/kernel/model/file.go
@@ -1640,6 +1640,15 @@ func removeDoc(box *Box, p string, luteEngine *lute.Lute) {
}
indexHistoryDir(filepath.Base(historyDir), util.NewLute())
+ // 刷新文档关联的数据库 https://github.com/siyuan-note/siyuan/issues/11731
+ allRemoveRootIDs := []string{tree.ID}
+ allRemoveRootIDs = append(allRemoveRootIDs, removeIDs...)
+ for _, rootID := range allRemoveRootIDs {
+ if removeTree, _ := LoadTreeByBlockID(rootID); nil != removeTree {
+ syncDelete2AttributeView(removeTree.Root)
+ }
+ }
+
if existChildren {
if err = box.Remove(childrenDir); nil != err {
logging.LogErrorf("remove children dir [%s%s] failed: %s", box.ID, childrenDir, err)