Check for update after rollback doesn't notify version changed
See original GitHub issueWhich @angular/* package(s) are the source of the bug?
service-worker
Is this a regression?
No
Description
Relates to #42940
Steps to reproduce:
- Step 1:
- Install version V1, open webpage
- Step 2:
- Install version V2
- call
swUpdate.checkForUpdate()
- get notified about version change by
swUpdate.versionUpdates
- after prompt call
swUpdate.activateUpdate()
- and then
document.location.reload()
- Step 3:
- install version V1
- call
swUpdate.checkForUpdate()
Result: we don’t get notified about version change by versionUpdates subscription
Here is the reason:
async checkForUpdate() {
let hash = "(unknown)";
try {
const manifest = await this.fetchLatestManifest(true);
if (manifest === null) {
this.debugger.log("Check for update aborted. (Client or server offline.)");
return false;
}
hash = hashManifest(manifest);
// if (this.versions.has(hash) { <<<<<<<<<<<<<<<<<<< current detection which doesn't check about rolled-back hash
if (this.versions.has(hash) && hash === this.latestHash) { <<<<<<<< I added check to against latest hash
return false;
}
await this.notifyClientsAboutVersionDetected(manifest, hash);
await this.setupUpdate(manifest, hash);
return true;
} catch (err) {
this.debugger.log(err, `Error occurred while updating to manifest ${hash}`);
this.state = DriverReadyState.EXISTING_CLIENTS_ONLY;
this.stateMessage = `Degraded due to failed initialization: ${errorToString(err)}`;
return false;
}
}
From the #42940 thread, I still don’t get the solution in our case.
New app detection only works when re-open the browser. I guess cleanupCaches()
is called by initialize
which then takes latest hash into account
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Application isn't notified about downgraded version if browser isn't re-opened, if we install V1, install V2, then downgrade to V1 (all in timespan when browser is opened)
Please provide the environment you discovered this bug in (run ng version
)
Angular CLI: 13.0.3
Node: 16.15.1
Package Manager: npm 8.5.5
OS: win32 x64
Angular:
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.1300.3 (cli-only)
@angular-devkit/core 13.0.3 (cli-only)
@angular-devkit/schematics 13.0.3 (cli-only)
@schematics/angular 13.0.3 (cli-only)
Anything else?
No response
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
problems with Windows update and rollback
TL:DR - I manually installed an update 3 days ago, found I despised it, rolled it back, and now: -the start menu wont...
Read more >Continue rolling back an update - AWS CloudFormation
A stack goes into the UPDATE_ROLLBACK_FAILED state when AWS CloudFormation can't roll back all changes during an update. For example, you might have...
Read more >How to Rollback WordPress - Undo WordPress Updates (Easy ...
Let's take a look at how you can easily rollback WordPress plugins using a version control designed for absolute beginners.
Read more >Notify users to restart to apply pending updates - Chrome ...
As a Chrome Enterprise administrator, you can set policies to tell users that they need to relaunch ... changes to indicate that an...
Read more >Windows 11: How to Roll Back Windows 11 - Sweetwater
Ever since the Windows 10 Anniversary Update (version 1607), ... One easy way to tell is when something breaks once the update has...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@gkalpak Thank you for the explanation. Can be closed
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.