-
Notifications
You must be signed in to change notification settings - Fork 168
fix(useTrackerSuspense): fix performance issues when multiple useTracker with suspense exist and rebuild test cases. Closes #454 #455
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
Conversation
|
Nice! I was going to tackle this today and your solution seems very elegant! this closes #454 |
Grubba27
left a comment
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 good! I'll release a beta with these changes and we can test around
…ker with suspense exist and rebuild test cases. Closes meteor#454
|
Published this under [email protected] please give a test and let me know! |
@Grubba27 during testing of version 4.0.1-beta.0, I identified an issue with the withDeps implementation and have submitted a new PR (#457) to address it. |
Summary
This PR primarily addresses the performance issue described in #454.
Problem Analysis
In the original implementation, the cache was immediately cleared every time a Promise was thrown and resolved. This caused components to re-throw Promises upon updates, leading to an exponential growth in Promise throwing when multiple
useTrackerhooks were used concurrently.Solution
The key insight is that immediate cache clearance is only necessary on the Server-Side. This optimization significantly reduces unnecessary Promise re-throws and improves performance in components with multiple
useTrackerinstances.Additional Changes
useTrackerwith Suspense functionality