Repository navigation
Show live sync status next to the JavStore controls (6.13.0) - #24
Conversation
A tab opened during a long sync starts from the history as it was before it, and on AdGuard downloads the whole history again itself. A status pill now shows when to wait: - "Downloading history… N visits" / "Syncing… N visits" while this tab's exchange runs longer than a moment (quick syncs show nothing); - "Waiting for another tab to sync…" while this tab's sync is queued on the shared Web Lock; - "Another tab is syncing…" in the tab in view, found by asking the browser whether the sync lock is held (navigator.locks.query, every 2 s, only while visible); AdGuard tabs cannot read each other's storage, but they do share Web Locks; - "Sync complete" for a few seconds afterwards. The test harness's Web Locks stand-in now answers query(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VCuhK4TQqcEbLXdmxLjggy
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Workers Builds: javstore-sync failed here, but not because of this PR.
The repo's own Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0485c5ae5b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <div class="dock" aria-label="JavStore cleanup controls"> | ||
| <button class="pill update" type="button" hidden>⚠ Update script</button> | ||
| <button class="pill redeploy" type="button" hidden>⚠ Redeploy worker</button> | ||
| <button class="pill sync-status" type="button" role="status" aria-live="polite" hidden></button> |
There was a problem hiding this comment.
Keep the sync status visible on narrow screens
On phone-sized viewports, this adds a long status label to .dock, which remains a single-row flex container; the mobile rule only changes its offsets. When the controls exceed the viewport width, the dock can extend offscreen and clip the status pill, making the wait cue unreadable on the mobile devices this change is intended to help. Wrap or stack the dock at narrow widths.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed, and fixed in the commit I'm about to push (it wasn't pushed when this was posted).
At 390 px, "Downloading history… 3,000 visits" forced every pill onto two lines against the left edge, and an "⚠ Update script" pill would have pushed the dock off-screen.
The fix:
- At ≤520 px the dock spans the width and wraps.
- The status takes its own full-width row above the other controls (
order: -1; flex: 1 0 100%). - Pills no longer wrap their labels.
- Because the dock now spans the width, it has
pointer-events: none, withautoon its children, so taps on the empty area still reach the page.
Checked in Chromium:
- At 390 and 320 px the status sits on its own row.
- The 900 px layout is unchanged.
elementFromPointin the empty dock area returns the page, not the controls host.
New test on narrow screens the dock wraps, puts the status first, and lets taps through; 138/138 pass.
Generated by Claude Code
🚀 Deploying Preview to Cloudflare 🚀Preview Deployments by commit
|
At 520 px and below the dock wraps and the sync status takes a full-width row of its own above the other controls, so a long label such as "Downloading history… 3,000 visits" can neither squeeze the pills onto two lines nor push the dock off-screen. Pills keep their labels on one line. The dock spans the width there, so its empty part lets taps through to the page. Reported by the Codex review on the pull request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VCuhK4TQqcEbLXdmxLjggy
Why
On AdGuard, a tab opened during a long sync starts from the history as it was before the sync. It then downloads the whole history again itself. That often happens with the first sync after an update. Users had no way to tell a sync was still running.
What changes
A status pill next to the JavStore controls:
AdGuard tabs can't read each other's storage, but they do share Web Locks. The tab in view calls
navigator.locks.query()every 2 s and shows "Another tab is syncing…" once two checks in a row find the lock held. Nothing is stored or sent. Hidden tabs don't poll, and polling stops onpagehide. Tapping the pill opens the panel, and its tooltip explains why waiting helps.The worker is unchanged. Its version moves to 6.13.0 with the script, as a test requires.
Testing
npm test: 137/137 pass. Newtests/sync-status.test.mjscovers:locks.query().query().JVS_DOTTED=1 npm test: 137/137 pass (the Userscripts app's API shape).Generated by Claude Code