Skip to content

Show live sync status next to the JavStore controls (6.13.0) - #24

Merged
jitdor merged 2 commits into
mainfrom
claude/gracious-keller-do6d7n
Nov 14, 2026
Merged

jitdor merged 2 commits into
mainfrom
claude/gracious-keller-do6d7n

Conversation

@jitdor

@jitdor jitdor commented Nov 14, 2026

Copy link
Copy Markdown
Owner

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:

Status When
Downloading history… N visits This tab is downloading a large history, with the count so far
Syncing… N visits A longer sync in this tab (quick syncs show nothing)
Waiting for another tab to sync… This tab's sync is queued on the shared Web Lock
Another tab is syncing… Any other tab holds the sync lock, shown in the tab in view
Sync complete For 3 s after a sync the user could see

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 on pagehide. 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. New tests/sync-status.test.mjs covers:
    • progress, then "Sync complete";
    • a quick sync showing nothing;
    • waiting on another tab's lock;
    • another tab's sync seen through locks.query().
  • The harness's Web Locks stand-in now answers query().
  • JVS_DOTTED=1 npm test: 137/137 pass (the Userscripts app's API shape).
  • Rendered in Chromium against a worker that never answers, to check the pill's appearance.

Generated by Claude Code

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
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T20:20:44.556543Z 0485c5a PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

jitdor commented Nov 14, 2026

Copy link
Copy Markdown
Owner Author

Workers Builds: javstore-sync failed here, but not because of this PR.

The repo's own test check is the one that decides whether this can merge.


Generated by Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, with auto on 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.
  • elementFromPoint in 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

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Failed ❌

View logs ↗
fa11b13 2026-11-14T20:25:49.469Z View logs ↗
  • Build: Failed ❌

View logs ↗
0485c5a 2026-11-13T20:27:34.404Z View logs ↗

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
@jitdor
jitdor merged commit fe8897f into main Nov 14, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants