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

Cache in service worker for offline experience #18147

Closed
HKalbasi opened this issue Jul 21, 2021 · 6 comments
Closed

Cache in service worker for offline experience #18147

HKalbasi opened this issue Jul 21, 2021 · 6 comments

Comments

@HKalbasi
Copy link

Currently there is just an empty service worker. It seems there was a functional service worker, but it is removed in cfee4c9#diff-1fb26bc12ac780c7ad7325730ed09fc4c2c3d757c276c3dacc44bfe20faf166f and reverted. Why? It is useful for faster initial times and better experience for network problems.

@t3chguy
Copy link
Member

t3chguy commented Jul 21, 2021

#15352

Due to how we handle updates and versioning it became quite problematic, the solution will need more experimentation.

It was causing updates to not happen due to it disagreeing that an update was needed, given how we have our version just in a loose text file, I think it'd need to be embedded into the code for this to work better.

@HKalbasi
Copy link
Author

So just change the handler to StaleWhileRevalidate?

Or better, CacheFirst for assets that have content hash in their names, and StaleWhileRevalidate for others?

@t3chguy
Copy link
Member

t3chguy commented Jul 21, 2021

StaleWhileRevalidate didn't work for the automatic update prompt that came up in the app and workbox offered no sane way to override it. We either have to work the update prompt around the service worker or vice versa, out of the box neither likes the other

@HKalbasi
Copy link
Author

Aha, so a hand written service worker is the way to go? Or workbox without webpack plugin? Or making changes in versioning system?

@t3chguy
Copy link
Member

t3chguy commented Jul 22, 2021

One of the above, I'd kinda prefer using a solid approach like workbox and improving our versioning/update mechanism given it is very naive and basic atm (just watches a /version file for changes, in theory if an update happens as you are loading the page atm your app will fetch the wrong (newer) version file and thus be confused and miss an update)

@t3chguy
Copy link
Member

t3chguy commented May 16, 2023

Duplicate of #7984

@t3chguy t3chguy marked this as a duplicate of #7984 May 16, 2023
@t3chguy t3chguy closed this as completed May 16, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants