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

Update service worker to perform caching activities in install event #66067

Open
jonahwilliams opened this issue Sep 17, 2020 · 2 comments
Open
Labels
c: new feature Nothing broken; request for a new capability P3 Issues that are less important to the Flutter project platform-web Web applications specifically team-web Owned by Web platform team tool Affects the "flutter" command-line tool. See also t: labels. triaged-web Triaged by Web platform team

Comments

@jonahwilliams
Copy link
Member

The service worker event activate is not guaranteed to run to completion, for example if the browser closes. If it fails or ends early, then it will never be rerun.

The install event has stronger guarantees, and is a better solution for updating the caches.

@jonahwilliams jonahwilliams added c: new feature Nothing broken; request for a new capability tool Affects the "flutter" command-line tool. See also t: labels. platform-web Web applications specifically P3 Issues that are less important to the Flutter project labels Sep 17, 2020
@jonahwilliams
Copy link
Member Author

activate could be updated to only perform cleanup

@jonahwilliams jonahwilliams added this to Awaiting triage in Tools - web review via automation Sep 17, 2020
@jonahwilliams jonahwilliams moved this from Awaiting triage to Engineer reviewed in Tools - web review Sep 17, 2020
@jeffposnick
Copy link

Congrats on the Flutter 2 PWA launch!

I was taking a look at the service worker for one of the sample apps, which I assume is representative of all Flutter PWAs.

Unfortunately, the activate handler is still being used for critical cache manipulation, not just cleanup. I've mentioned this elsewhere, but putting any data operations that require guaranteed completion inside of activate handler risks cache inconsistency, as we experienced in the Workbox project (GoogleChrome/workbox#1793).

Apologies if I'm misreading your service worker, but based on the fact that this issue is still open, I'm assuming that I'm correct in that assessment.

@yjbanov yjbanov added this to To do in PWA Jun 16, 2022
@flutter-triage-bot flutter-triage-bot bot added multiteam-retriage-candidate team-web Owned by Web platform team triaged-web Triaged by Web platform team labels Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: new feature Nothing broken; request for a new capability P3 Issues that are less important to the Flutter project platform-web Web applications specifically team-web Owned by Web platform team tool Affects the "flutter" command-line tool. See also t: labels. triaged-web Triaged by Web platform team
Projects
PWA
To do
Tools - web review
  
Engineer reviewed
Development

No branches or pull requests

4 participants