Closed yched closed 1 year ago
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
w00t ! Kudos for the super quick fix, glad this could help :-)
It was published under the namespace react-meteor-data@2.6.2. If this issue is still not solved, please reopen it.
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