Fallback strategy does not return from cache upon network error / when offline
Opened this issue · 0 comments
robbytx commented
Version
0.7.1
Steps to reproduce
- Check out https://github.com/ember-cli/ember-new-output (I'm using version
3.12
) ember install ember-service-worker
(9.0.1) &&ember install ember-service-worker-index
(0.7.1)- Enable
fallback
strategy inember-cli-build.js
:
let app = new EmberApp(defaults, {
'esw-index': {
strategy: 'fallback',
},
});
ember serve
- Open http://localhost:4200/ in Chrome (89.0.4389.82)
- Use DevTools to confirm service worker is registered and
esw-index-1
cache contains/index.html
entry. - Use DevTools Network tab to set the network to "Offline"
- Refresh the page.
- Observe that page fails to load:
Expected Behavior
The cached index.html
document should be used by the browser when the network is offline.
Note that this repro would also need ember-service-worker-asset-cache
or similar for the app to fully load, so the expected behavior is simply that the document would load and you would instead see failed network requests for assets.
Actual Behavior
The service worker propagates the network error to the browser, even though the file exists in the cache.