Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ServiceWorker doesn't update the app when going "back" to a previous version #8962

Closed
MrCroft opened this issue Dec 21, 2017 · 4 comments
Closed
Labels
needs: investigation Requires some digging to determine if action is needed P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful

Comments

@MrCroft
Copy link

MrCroft commented Dec 21, 2017

Bug Report or Feature Request

- [x] bug report

Versions

Angular: 5.1.1
Angular CLI: 1.6.1

Repro steps

  1. Create an app (with ServiceWorker) using Angular CLI
  2. Build & Serve the app so the ServiceWorker initializes (let's say this would be version 1 of the app).
  3. Change anything in the app.
  4. Rebuild & Serve (let's say this is version 2 of the app).
  5. Access the app and then refresh to get the update.
  6. Undo the change you did at point (3) above.
  7. Rebuild & Serve.
  8. Access the app and try refreshing to get the update. Nothing happens. You're stuck on version 2 of the app.

Observed behavior

The v1 code is still cached after the update to v2. I guess because there is no notion of "this is the bundle for module X". Each file is simply... a file.
But it just doesn't go "back" to use the previously cached version after we undo some changes that generate the exact v1 bundles again (or some of them, anyway).

Desired behavior

Any change in the app code should trigger the update.

@filipesilva filipesilva added needs: investigation Requires some digging to determine if action is needed type: discussion P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful labels Dec 21, 2017
@MrCroft
Copy link
Author

MrCroft commented Dec 30, 2017

I've just tested again, after updating Angular to 5.1.2 and CLI to 1.6.3.
On the same app, it didn't occur anymore.
Thinking it's weird (as I didn't see anything in the changelog that might have affected this), I started to try out different scenarios.
I could only reproduce it under one circumstance:
If I opened developer tools any time after point (5), having them opened at point (8) when reloading the first time after the build, as expected the service worker doesn't update. But, after closing developer tools, it still didn't update until I closed the tab and reopen it or manually updating the service worker.

I think it's the same thing that happened initially. And what threw me off was that I expected things to go back to normal right away with the first refresh, after closing dev tools.
But, maybe things don't go back to the normal behavior the very second after closing developer tools, once you had it open.

So, it looks like wasn't a real issue and can be closed. Sorry for the trouble!

@XavierDupessey
Copy link

related to angular/angular#24338?

@filipesilva
Copy link
Contributor

This seems to have been fixed as angular/angular#24338 so it should be closed here.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: investigation Requires some digging to determine if action is needed P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful
Projects
None yet
Development

No branches or pull requests

5 participants