-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Fix bug with cache and glob entries #9264
Conversation
This fixes #8477. I wasn't able to get a reliable repro in a test for this, but I have previously manually applied this patch in a large codebase where we saw this issue and it resolved it.
// Find potential file nodes to be invalidated if this file name pattern matches | ||
let above = this.getNodeIdsConnectedTo( | ||
let above: Array<FileNode> = []; | ||
for (const nodeId of this.getNodeIdsConnectedTo( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I originally had this code using .filter
but Flow didn't like that, it didn't know that above
only contained file nodes when passed in to invalidateFileNameNode
on line 783.
Benchmark ResultsKitchen Sink ✅
Timings
Cold BundlesNo bundle changes detected. Cached BundlesNo bundle changes detected. React HackerNews ✅
Timings
Cold Bundles
Cached BundlesNo bundle changes detected. AtlasKit Editor ✅
Timings
Cold Bundles
Cached Bundles
Three.js ✅
Timings
Cold BundlesNo bundle changes detected. Cached BundlesNo bundle changes detected. |
My reproduction still fails with 2.8.3 but then works fine starting from 2.9.0. 🤷 Must have been in this range |
↪️ Pull Request
This fixes #8477. The code assumed that all the nodes would be
file
nodes and would fail the invariant if they weren't, however when using the glob resolver there could also beglob
nodes. These can be safely ignored as globs are handled separately just below the affected code block.The change refactors the code to filter out only the
file
nodes rather than failing on any unexpected node types.🚨 Test instructions
I wasn't able to create a succesfully failing integration test, but have manually validated against the minimal reproduction in #8477.
✔️ PR Todo