소스 검색

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

Daniel 1 년 전
부모
커밋
e99852f067
1개의 변경된 파일9개의 추가작업 그리고 0개의 파일을 삭제
  1. 9 0
      kernel/model/file.go

+ 9 - 0
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)