Skip to content

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

:bug: 未登录状态云端同步状态图标显示错误 Fix https://github.com/siyuan-note/siyuan/issues/7277

Liang Ding448609d1a800
diff --git a/kernel/model/sync.go b/kernel/model/sync.go
index f4376d63b3..fc3908c5b9 100644
--- a/kernel/model/sync.go
+++ b/kernel/model/sync.go
@@ -62,6 +62,10 @@ func BootSyncData() {
return
}
+ if !util.IsOnline() {
+ return
+ }
+
syncLock.Lock()
defer syncLock.Unlock()
@@ -97,9 +101,13 @@ func SyncData(boot, exit, byHand bool) {
func syncData(boot, exit, byHand bool) {
defer logging.Recover()
- util.BroadcastByType("main", "syncing", 0, Conf.Language(81), nil)
if !checkSync(boot, exit, byHand) {
- util.BroadcastByType("main", "syncing", 1, "", nil)
+ return
+ }
+
+ util.BroadcastByType("main", "syncing", 0, Conf.Language(81), nil)
+ if !util.IsOnline() { // 这个操作比较耗时,所以要先推送 syncing 事件后再判断网络,这样才能给用户更即时的反馈
+ util.BroadcastByType("main", "syncing", 2, Conf.Language(28), nil)
return
}
@@ -173,11 +181,6 @@ func checkSync(boot, exit, byHand bool) bool {
planSyncAfter(64 * time.Minute)
return false
}
-
- if !util.IsOnline() {
- util.BroadcastByType("main", "syncing", 2, Conf.Language(28), nil)
- return false
- }
return true
}