StaleWhileRevalidate throws transient error when opening developer tools after a clean cache
See original GitHub issueLibrary Affected:
workbox-strategies@4.3.1
and workbox-strategies@5.1.3
(that’s all I’ve checked)
Browser & Platform: Chrome Desktop Version 83.0.4103.97 (Official Build) (64-bit)
Issue Description: We are seeing an error that only manifests when the chrome developer console is opened after site data has been cleared and the page refreshed.
To reproduce the bug:
- Go here: http://develop.pwa-venia.com/
- Open console and clear site data
- Refresh the page
- Close and reopen the dev console. You should see the error:
Further investigation showed this to be the same error from this stack overflow post and this github issue. So I’m opening this issue to see if ya’ll would be open to a contribution to the StaleWhileRevalidate
code.
I was able to prevent the error from being thrown by adding code to the _getFromNetwork
function:
async _getFromNetwork({ request, event }) {
if (request.cache === 'only-if-cached' && request.mode !== 'same-origin') {
return;
}
...
}
I also understand that this could be an old chromium issue but that issue has been marked as fixed and it wasn’t clear to me why or how.
Open to discussing alternatives. Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
I don’t feel great about adding in code to
workbox-strategies
to work around those “phantom” requests that DevTools initiates.I’ve reopened https://bugs.chromium.org/p/chromium/issues/detail?id=823392#c34 and I think that’s the place to follow up.
No, I think it’s just a side-effect of something in the DevTools codebase, and isn’t something that would be documented one way or another.