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

Clear file cache through a separate fetch::no-cache call #2977

Closed
wants to merge 1 commit into from

Conversation

infinite-persistence
Copy link
Collaborator

@infinite-persistence infinite-persistence commented Sep 29, 2023

Issue

ChunkLoadError.

There is anecdote1 saying that Chromium will cache failed responses (e.g. timeout), so users could end up perpetually in a bad state until the cache is manually cleared, or the site moved on to a different chunk.

Approach

While there is no way to programmatically clear a user's cache, doing a separate fetch with no-cache indirectly replaces the cache with a fresh download.

Here an experiment to prove the concept:

  1. In the first 2 reloads, we see the browser consistently/correctly using the one cached at 6.47pm.
  2. Assume the cache was bad, so we send a separate fetch :: no-cache to clear it.
  3. Reload. We see that the browser still used the cached version (correct behavior since filename didn't change or cache didn't expire), but it's a new one from 6:50pm.
2023-09-30.02-50-11--cache.mp4

Footnotes

  1. https://github.com/whatwg/html/issues/6768 -- confirmed to be true; can be replicated

@infinite-persistence infinite-persistence changed the title Clear file cache through through a separate fetch::no-cache call Clear file cache through a separate fetch::no-cache call Sep 29, 2023
## Issue
ChunkLoadError.

There is anecdote saying that Chromium will cache failed responses (e.g. timeout), so users could end up perpetually in a bad state until the cache is manually cleared, or the site moved on to a new chunk.

`https://github.com/whatwg/html/issues/6768`

## Approach
While there is no way to programmatically clear a user's cache, doing a separate `fetch` with `no-cache` indirectly replaces the cache with a fresh download.
@infinite-persistence
Copy link
Collaborator Author

--- close ---
Did not work under CF environment.
Next to try is the t=?<random> method mentioned in https://medium.com/@alonmiz1234/retry-dynamic-imports-with-react-lazy-c7755a7d557a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant