-
Notifications
You must be signed in to change notification settings - Fork 159
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
Serious perf / mem leak in useTracker (WithDeps) >= 2.5.0 #382
Comments
yched
referenced
this issue
Feb 1, 2023
Also re-adds an attempt to retain the "side-effect" we are creating during first render, when we can, to both versions of the hook
As can be seen in the video below, the issue will be solved in v2.6.2 Thanks a lot for your reproduction it was really helpful Also thanks a lot @radekmie for the call and the useful links Screen.Recording.2023-02-02.at.15.54.46.mov |
w00t ! |
It was published under the namespace [email protected]. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seen with react-meteor-data >= 2.5.0 (2.4 0 is fine), react 17.x or 18.x :
useTracker(fn, deps) updates too frequently, causing performance and memory leaks that accumulate over the component lifetime.
More precisely :
when its reactive dependencies change, then the reactive function reruns N times in a row (each causing a component update)
with N = 1 + [number of times the useTracker deps have changed since the component was mounted]
Simple reproduction code :
"Reactive value" toggles between 'A' and 'B' on each click on "Change reactive value" button
"Dependency" is a counter that increments on each click on "Change dependency"
--> Each click on "Change reactive value" logs the 're-run' message [1 + counter] times
The text was updated successfully, but these errors were encountered: