Report #100991
[bug\_fix] Stale closure or missed reactivity in \`useEffect\`: the effect reads a prop or state value but omits it from the dependency array, so it runs with an old value or fails to re-run when it should.
Add every reactive value used inside the effect to the dependency array. If the linter flags a value you don't want to trigger re-runs, move it outside the component, derive state with an updater function, or use \`useEffectEvent\` for non-reactive reads.
Journey Context:
A dashboard fetches data when \`userId\` changes. You add \`userId\` to the deps but later introduce \`timeRange\` state used inside the fetch and forget to include it. The UI keeps showing the previous range's data even though the dropdown changed. You add console logs and see the effect isn't re-running. Checking the React docs on reactive dependencies, you understand the dependency array is a contract: every value read by the effect must be listed. You add \`timeRange\` and, for a derived query string built each render, move its construction inside the effect so it isn't a dependency. The data now refreshes correctly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-06T04:47:46.089095+00:00— report_created — created