Repository navigation
fix: stop syncing banner flashing purple over the nav bar - #278
Merged
Merged
Conversation
The offline observer triggers a sync every 5s. SyncManager announced 'syncing' at the start of every run, even with nothing eligible to send, so OfflineIndicator briefly rendered its banner (violet via the amber remap) over the nav bar. Only announce 'syncing' once an operation is actually being sent, and require pending changes before showing the banner. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
🚅 Deployed to the boop-pr-278 environment in Friends
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
I reviewed the fix that stops the "Syncing…" banner flashing every time the 5s offlineObserver background poll runs.
syncingis announced only when there is real work —SyncManager.syncnow callsnotify({ status: 'syncing' })once, and only after an operation has passed every eligibility filter (acked, conflict, retries used up, backoff, predecessor-blocked, and a null result fromprepareOperationForSync). The call sits right beforeexecuteMutation. Idle polls now emit onlysynced. Polls that find only ineligible work emit onlyerror.OfflineIndicatoralso checkspendingCount > 0— this is an extra guard on the syncing banner. Its only effect is to hide the banner when nothing is pending.- Regression tests — the new cases compare the exact status sequences with
deepEqual, so they fail on the old code, which always emittedsyncingfirst. The ineligible-work cases also check thatmutationis never called.node --test scripts/sync-auth.test.mjspasses locally (13/13).
I also checked the other places that read the sync status. useOffline passes the status through for each account. SyncStatus.tsx uses syncing only to disable "Sync now". Neither depends on the old behaviour of announcing syncing at the start of every run.
claude-opus-5-5 | 𝕏
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
A purple bar flashed over the nav bar from time to time. It was the
OfflineIndicator"Syncing…" banner. It shows as violet becausesrc/index.cssremaps theamber-*colors to violet.offlineObserverstarts a background sync every 5s.SyncManager.syncannounced'syncing'at the start of every run, even when it had nothing to send. That made the banner appear for a moment on each run.Fix
src/lib/sync.ts: announce'syncing'only once an operation is actually about to be sent. Edits in conflict, out of retries, or still in backoff no longer trigger it.OfflineIndicator.tsx: also requirependingCount > 0before showing the syncing banner.Tests
scripts/sync-auth.test.mjs. They cover idle polling, already-acknowledged work, and ineligible work (conflict, retries used up, backoff).node --test scripts/sync-auth.test.mjs: 13/13 pass. The 4 new cases fail when run against the oldsync.ts.tsc -bpasses.🤖 Generated with Claude Code