question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Check for update after rollback doesn't notify version changed

See original GitHub issue

Which @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:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jHabjanMXPcommented, Jul 6, 2022

@gkalpak Thank you for the explanation. Can be closed

0reactions
angular-automatic-lock-bot[bot]commented, Aug 7, 2022

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.

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found