feat: harden service worker cache invalidation and update prompts (#680)#688
Open
knoxiboy wants to merge 1 commit into
Open
feat: harden service worker cache invalidation and update prompts (#680)#688knoxiboy wants to merge 1 commit into
knoxiboy wants to merge 1 commit into
Conversation
cbcf77d to
b260e7b
Compare
Author
|
@Shruti070107 Please review this pr and merge it |
1 similar comment
Author
|
@Shruti070107 Please review this pr and merge it |
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.
Description
Resolves #680
This PR hardens Service Worker registration update handling. It wires listeners for
updatefoundandstatechangeevents, detecting when a new service worker transitions to theinstalled(waiting) state. It then displays a floating toast/prompt alerting the user that a new version of ReGenX is available and offers a "Reload" button to trigger activation.What changed
showUpdatePromptand wired check forreg.waitingon load insidesrc/app.js.updatefoundupdate triggers to detect when a new worker becomes available./service-worker.jsat the end ofsrc/app.js.Why
When the Service Worker is updated with new modules, files in the cache might mismatch with active client modules, leading to blank screens or load crashes if not immediately activated and reloaded.
How to test
service-worker.jsor changeCACHE_VERSIONvalue.Checklist
Files Affected
src/app.js