mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-21 15:56:10 +01:00
🎨 Partially refresh the interface after data synchronization https://github.com/siyuan-note/siyuan/issues/8098
This commit is contained in:
parent
9bfc7846cd
commit
125700d075
3 changed files with 26 additions and 27 deletions
|
|
@ -1053,8 +1053,6 @@ func bootSyncRepo() (err error) {
|
|||
|
||||
if 0 < len(fetchedFiles) {
|
||||
go func() {
|
||||
util.WaitForUILoaded() // 等待一段时间后前端完成界面初始化后再同步,因为需要推送消息
|
||||
|
||||
syncErr := syncRepo(false, false)
|
||||
if nil != err {
|
||||
logging.LogErrorf("boot background sync repo failed: %s", syncErr)
|
||||
|
|
@ -1239,33 +1237,35 @@ func processSyncMergeResult(exit, byHand bool, start time.Time, mergeResult *dej
|
|||
return
|
||||
}
|
||||
|
||||
incReindex(upserts, removes)
|
||||
if !exit {
|
||||
ReloadUI()
|
||||
if exit { // 退出时同步不用推送事件
|
||||
return
|
||||
}
|
||||
|
||||
upsertRootIDs, removeRootIDs := incReindex(upserts, removes)
|
||||
elapsed := time.Since(start)
|
||||
if !exit {
|
||||
go func() {
|
||||
time.Sleep(2 * time.Second)
|
||||
util.PushStatusBar(fmt.Sprintf(Conf.Language(149), elapsed.Seconds()))
|
||||
go func() {
|
||||
util.WaitForUILoaded()
|
||||
util.BroadcastByType("main", "syncMergeResult", 0, "",
|
||||
map[string]interface{}{"upsertRootIDs": upsertRootIDs, "removeRootIDs": removeRootIDs})
|
||||
|
||||
if 0 < len(mergeResult.Conflicts) {
|
||||
syConflict := false
|
||||
for _, file := range mergeResult.Conflicts {
|
||||
if strings.HasSuffix(file.Path, ".sy") {
|
||||
syConflict = true
|
||||
break
|
||||
}
|
||||
}
|
||||
time.Sleep(2 * time.Second)
|
||||
util.PushStatusBar(fmt.Sprintf(Conf.Language(149), elapsed.Seconds()))
|
||||
|
||||
if syConflict {
|
||||
// 数据同步发生冲突时在界面上进行提醒 https://github.com/siyuan-note/siyuan/issues/7332
|
||||
util.PushMsg(Conf.Language(108), 7000)
|
||||
if 0 < len(mergeResult.Conflicts) {
|
||||
syConflict := false
|
||||
for _, file := range mergeResult.Conflicts {
|
||||
if strings.HasSuffix(file.Path, ".sy") {
|
||||
syConflict = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
if syConflict {
|
||||
// 数据同步发生冲突时在界面上进行提醒 https://github.com/siyuan-note/siyuan/issues/7332
|
||||
util.PushMsg(Conf.Language(108), 7000)
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func logSyncMergeResult(mergeResult *dejavu.MergeResult) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue