-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove expired link resources via MutationObserver during development (…
…#48578) Closes NEXT-684, closes #43396. This PR implements a temporary workaround to address the issue that some browsers are always caching CSS resources during the lifetime of a session. We re-introduce the versioning query to the resource to avoid that, and then use Mutation Observer to do GC manually on the client. Once Float handles that by itself, we can probably remove this. Note that correctly handling GC here is **required** for correctness, not an optimization. That's why it took us a while to address this (even this PR is still a temporary workaround). Imagine that if you have: ```css h1 { color: red; } ``` and then you changed it to: ```css h1 { font-size: 300px; } ``` During HMR, if we don't remove the old resources but only insert the new one, both will be applied and you will still see the `<h1>` in red, which is wrong. Here's a recording of this PR working correctly in Firefox: https://user-images.githubusercontent.com/3676859/233132831-b88e4d8d-aec9-48c4-9aa7-7c7a149b377d.mp4
- Loading branch information
Showing
4 changed files
with
76 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters