-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
perf(hmr): keep track of already traversed modules when propagating update #12658
Conversation
Run & review this pull request in StackBlitz Codeflow. |
I tried this on my repo where I was having issues with thousands of HMR updates and it fixes the HMR performance for me. |
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
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.
Forgot to loop back on this PR, but this looks like a nice and safe change. ecosystem-ci seems to be invalid for the failing ones.
importer, | ||
traversedModules, | ||
boundaries, | ||
currentChain.concat(importer), |
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.
Looks great! Let's merge so we can test it during the beta.
Later on, maybe it is worth exploring using a data structure for currentChain
/propagateUpdate
that doesn't require the creation of new arrays on every call.
Re: #12062
Not sure this is a complete fix, but probably helps.
This will mostly help people having tree structure like this:
Note: This is not an adviced pattern, and I highly recommend having direct imports from views to components inside the same project. This will always lead to faster HMR (not all views need to refresh on an non self accepting file that is currently re-exported by a barrel file)
I also changed the data structure of
boundaries
to an array because a set is misleading