Browse Source

fix(model): avoid flashing "Sync Waiting" unnecessarily (#10181)

Jakob Borg 4 months ago
parent
commit
af64140c61
1 changed files with 6 additions and 2 deletions
  1. 6 2
      lib/model/folder.go

+ 6 - 2
lib/model/folder.go

@@ -188,8 +188,12 @@ func (f *folder) Serve(ctx context.Context) error {
 		case <-f.pullScheduled:
 			if f.PullerDelayS > 0 {
 				// Wait for incoming updates to settle before doing the
-				// actual pull
-				f.setState(FolderSyncWaiting)
+				// actual pull. Only set the state to SyncWaiting if we have
+				// reason to believe there is something to sync, to avoid
+				// unnecessary flashing in the GUI.
+				if needCount, err := f.db.CountNeed(f.folderID, protocol.LocalDeviceID); err == nil && needCount.TotalItems() > 0 {
+					f.setState(FolderSyncWaiting)
+				}
 				pullTimer.Reset(time.Duration(float64(time.Second) * f.PullerDelayS))
 			} else {
 				_, err = f.pull()