🎨 Refresh the doc tree after data sync generates conflicting documents https://github.com/siyuan-note/siyuan/issues/11137
This commit is contained in:
parent
4ce87c7eb8
commit
d88731712d
2 changed files with 9 additions and 2 deletions
|
@ -1347,6 +1347,7 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,
|
|||
|
||||
//logSyncMergeResult(mergeResult)
|
||||
|
||||
var needReloadFiletree bool
|
||||
if 0 < len(mergeResult.Conflicts) {
|
||||
luteEngine := util.NewLute()
|
||||
if Conf.Sync.GenerateConflictDoc {
|
||||
|
@ -1375,6 +1376,8 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,
|
|||
resetTree(tree, "Conflicted")
|
||||
createTreeTx(tree)
|
||||
}
|
||||
|
||||
needReloadFiletree = true
|
||||
}
|
||||
|
||||
historyDir := filepath.Join(util.HistoryDir, mergeResult.Time.Format("2006-01-02-150405")+"-sync")
|
||||
|
@ -1401,7 +1404,7 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,
|
|||
var upserts, removes []string
|
||||
var upsertTrees int
|
||||
// 可能需要重新加载部分功能
|
||||
var needReloadFlashcard, needReloadOcrTexts, needReloadFiletree, needReloadPlugin bool
|
||||
var needReloadFlashcard, needReloadOcrTexts, needReloadPlugin bool
|
||||
for _, file := range mergeResult.Upserts {
|
||||
upserts = append(upserts, file.Path)
|
||||
if strings.HasPrefix(file.Path, "/storage/riff/") {
|
||||
|
@ -1465,7 +1468,7 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,
|
|||
}
|
||||
|
||||
if needReloadFiletree {
|
||||
util.BroadcastByType("filetree", "reloadFiletree", 0, "", nil)
|
||||
util.PushReloadFiletree()
|
||||
}
|
||||
|
||||
if exit { // 退出时同步不用推送事件
|
||||
|
|
|
@ -158,6 +158,10 @@ func PushBackgroundTask(data map[string]interface{}) {
|
|||
BroadcastByType("main", "backgroundtask", 0, "", data)
|
||||
}
|
||||
|
||||
func PushReloadFiletree() {
|
||||
BroadcastByType("filetree", "reloadFiletree", 0, "", nil)
|
||||
}
|
||||
|
||||
type BlockStatResult struct {
|
||||
RuneCount int `json:"runeCount"`
|
||||
WordCount int `json:"wordCount"`
|
||||
|
|
Loading…
Add table
Reference in a new issue