Skip to content

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

:art: Refresh doc tree after data sync https://github.com/siyuan-note/siyuan/issues/12860

Daniel667c9075b590
diff --git a/kernel/model/repository.go b/kernel/model/repository.go
index 7410347047..5a926c3119 100644
--- a/kernel/model/repository.go
+++ b/kernel/model/repository.go
@@ -1521,10 +1521,6 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,
return
}
- if needReloadFiletree {
- util.PushReloadFiletree()
- }
-
if exit { // 退出时同步不用推送事件
return
}
@@ -1539,18 +1535,24 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,
box.Index()
}
}
- if 0 < len(needUnindexBoxes) || 0 < len(needIndexBoxes) {
+
+ needReloadUI := 0 < len(needUnindexBoxes) || 0 < len(needIndexBoxes)
+ if needReloadUI {
util.ReloadUI()
}
upsertRootIDs, removeRootIDs := incReindex(upserts, removes)
+ needReloadFiletree = !needReloadUI && (needReloadFiletree || 0 < len(upsertRootIDs) || 0 < len(removeRootIDs))
+ if needReloadFiletree {
+ util.PushReloadFiletree()
+ }
+
go func() {
util.WaitForUILoaded()
if 0 < len(upsertRootIDs) || 0 < len(removeRootIDs) {
util.BroadcastByType("main", "syncMergeResult", 0, "",
map[string]interface{}{"upsertRootIDs": upsertRootIDs, "removeRootIDs": removeRootIDs})
- util.PushReloadFiletree()
}
time.Sleep(2 * time.Second)