mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-09 10:18:50 +01:00
🎨 校验索引发现文件系统相关问题并修复后自动刷新界面
This commit is contained in:
parent
fe63530325
commit
675318dbbc
6 changed files with 21 additions and 5 deletions
|
|
@ -113,6 +113,7 @@ func resetDuplicateBlocksOnFileSys() {
|
|||
boxes := Conf.GetBoxes()
|
||||
luteEngine := lute.New()
|
||||
blockIDs := map[string]bool{}
|
||||
needRefreshUI := false
|
||||
for _, box := range boxes {
|
||||
boxPath := filepath.Join(util.DataDir, box.ID)
|
||||
filepath.Walk(boxPath, func(path string, info os.FileInfo, err error) error {
|
||||
|
|
@ -158,6 +159,7 @@ func resetDuplicateBlocksOnFileSys() {
|
|||
// 如果是文档根节点,则直接重置这颗树
|
||||
logging.LogWarnf("exist more than one tree with the same id [%s], reset it", box.ID+p)
|
||||
recreateTree(tree, path)
|
||||
needRefreshUI = true
|
||||
return ast.WalkStop
|
||||
}
|
||||
|
||||
|
|
@ -165,6 +167,7 @@ func resetDuplicateBlocksOnFileSys() {
|
|||
needOverwrite = true
|
||||
n.ID = ast.NewNodeID()
|
||||
n.SetIALAttr("id", n.ID)
|
||||
needRefreshUI = true
|
||||
return ast.WalkContinue
|
||||
})
|
||||
|
||||
|
|
@ -177,6 +180,14 @@ func resetDuplicateBlocksOnFileSys() {
|
|||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
if needRefreshUI {
|
||||
util.ReloadUI()
|
||||
go func() {
|
||||
time.Sleep(time.Second * 3)
|
||||
util.PushMsg(Conf.Language(190), 5000)
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
func recreateTree(tree *parse.Tree, absPath string) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue