Add networkTimeoutSeconds to NetworkOnly strategy
See original GitHub issueAt present, it is possible to set timeout only for NetworkFirst
strategy:
workbox.strategies.networkFirst({networkTimeoutSeconds: 10});
When NetworkOnly
strategy is used to retrieve non-cacheable data, it keeps waiting indefinitely in case of a network issue.
Suggested implementation: https://github.com/github/fetch/issues/175#issuecomment-216791333
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
workbox-strategies - Chrome Developers
NetworkOnly. An implementation of a network-only request strategy. This class is useful if you want to take advantage of any Workbox plugins. If ......
Read more >Workbox: PWA with steroids - Kruk Matias - Medium
For this, you can use a NetworkFirst strategy with the networkTimeoutSeconds option configured. Example: workbox.routing.registerRoute(
Read more >What's the use case for Workbox NetworkOnly strategy
... you might want to explicitly create a route that matches some criteria and applies a NetworkFirst strategy: import {NetworkOnly ...
Read more >injectManifest | Workbox - Vite PWA - Netlify
You can use the following code to create your custom service worker to be used with network first strategy. We also include how...
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
Just to be clear, though, there really should be a reasonable timeout imposed by the user agent by default. If the current per-browser defaults aren’t reasonable, that’s good feedback to pass along to browsers that wait too long.
I’m happy to have folks turn to Workbox to give them more control when they want to override those defaults for specific types of requests, but obviously not everyone is going to use Workbox, and a service worker will likely not be in control during the user’s first visit to a site.
@jeffposnick Yes. Imho it’s better to let the user know something went wrong in a reasonable time than just keep some progress indicator spinning forever 😃 Example: