Repository navigation
fix(pwa): install overlay no longer hangs on repeat visits - #3
Merged
Merged
Conversation
`useRegisterSW`'s `offlineReady` flag only fires on the very first SW install. On any later visit where `controller` is briefly null at mount (shift-reload, fresh tab before the existing SW claims the client) the overlay would lock open until the user manually reloaded the page. Hide the overlay also when the SW is otherwise observably ready: `navigator.serviceWorker.ready` resolving with an active registration, or a `controllerchange` event landing a controller. Both signals fire on the repeat-visit path that `offlineReady` misses. Adds two regression tests covering the ready / controllerchange paths and keeps the existing six tests untouched in semantics. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 of 4 tasks
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.
useRegisterSW'sofflineReadyflag only fires on the very first SW install. On any later visit wherecontrolleris briefly null at mount (shift-reload, fresh tab before the existing SW claims the client) the overlay would lock open until the user manually reloaded the page.Hide the overlay also when the SW is otherwise observably ready:
navigator.serviceWorker.readyresolving with an active registration, or acontrollerchangeevent landing a controller. Both signals fire on the repeat-visit path thatofflineReadymisses.Adds two regression tests covering the ready / controllerchange paths and keeps the existing six tests untouched in semantics.