You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
useTracker renders two times at mount, would be nice if it renders only once #439
The fix is based on the approach from #436 (simpler useTracker with useSyncEffect) but refined:
Added useSyncEffect hook that runs effects synchronously during render but defers cleanup by 1 second to avoid StrictMode double-rendering issues
Simplified useTrackerNoDeps to delegate to useTrackerWithDeps
Updated useTrackerWithDeps to use useSyncEffect for managing the Tracker computation lifecycle
The root cause was that the old useTrackerNoDeps would stop and recreate the computation on every render, which combined with StrictMode caused extra renders.
Activity
Poyoman39 commentedon Apr 14, 2025
This PR #436 intends to fix this issue
Poyoman39 commentedon Apr 14, 2025
This PR #440 intends to add a test for this issue
nachocodoner commentedon Apr 17, 2025
Is this related with useSubscribe as well as reported in the forums https://forums.meteor.com/t/usesubscribe-and-usetracker-fire-multiple-times-react-meteor-data/63448/4?
I wonder if latest fixes on master have fixed it, likely not yet. Last published version,
meteor add react-meteor-data@3.0.5-beta.0Poyoman39 commentedon Apr 17, 2025
Not sure 🤔 I can write a test to confirm this if you want @nachocodoner
nachocodoner commentedon Apr 17, 2025
That'd be great @Poyoman39
fix: simplify useTrackerNoDeps to fix StrictMode double-rendering (cl…
nicolv commentedon Apr 28, 2026
I've submitted a PR to fix this issue: #482
The fix is based on the approach from #436 (simpler useTracker with useSyncEffect) but refined:
useSyncEffecthook that runs effects synchronously during render but defers cleanup by 1 second to avoid StrictMode double-rendering issuesuseTrackerNoDepsto delegate touseTrackerWithDepsuseTrackerWithDepsto useuseSyncEffectfor managing the Tracker computation lifecycleThe root cause was that the old
useTrackerNoDepswould stop and recreate the computation on every render, which combined with StrictMode caused extra renders.Feedback welcome!