Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Replaces the simple autoReloadAllowed flag from #2032 with a full 5 s visible-dwell requirement and opt-in debug logging. Changes vs main: Dwell timer (5 s): Auto-reload on tab-hide only arms after VISIBLE_DWELL_MS of continuous visibility. Hidden time is NOT counted — the timer is cancelled whenever the tab goes hidden before expiry and restarts from zero on the next foreground. Prevents session-restore ghost reloads and background infinite reload loops. Debug log (opt-in): localStorage.setItem('wm-debug-sw', '1') enables console + sessionStorage logging (key: wm-sw-debug-log, rolling 30 entries). Logs the full toast lifecycle: handler-installed, controllerchange, toast-shown, dwell-timer- started/cancelled/expired, visibility transitions, auto-reload, dismiss. __APP_VERSION__ included in every entry via version option in main.ts. P2 fix: When a newer deploy supersedes an existing toast, its pending dwell timer is cancelled via currentDwellCancel so it cannot fire after the toast is gone and pollute the debug log. New options: setTimer, clearTimer (test injection), debug, version. 22 tests covering all dwell timer mechanics, all pass.
75b9c70 to
32f31d1
Compare
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.
Summary
VISIBLE_DWELL_MScontinuously since the toast appeared. Prevents the infinite background-tab reload loop (hidden tab → SW update detected →onHiddenfires immediately → reload → still hidden → same cycle) and session-restore ghost reloads.localStorage.setItem('wm-debug-sw', '1'). Stores up to 30 timestamped entries insessionStorage['wm-sw-debug-log']covering the full toast lifecycle. Useful for diagnosing future SW reload reports post-mortem.__APP_VERSION__wired into the handler so log entries carry the deployed build version.Test plan
node --test tests/sw-update.test.mts)