Compiler incorrectly handles NaN in dependency lists causing unnecessary re-evaluations.
The issue reports that the React compiler mishandles NaN values in useMemo dependency lists, causing unnecessary re-evaluations. This requires understanding compiler internals around dependency comparison logic. While the reproduction case is clear, the fix may involve non-trivial changes to dependency tracking.
See playground link. Click on the div to increment the counter and see that the memoised value changes even though the single dependency is always NaN.
The example is obviously contrived and perhaps you consider having NaN in a dependency list not valid/supported. However useMemo without the compiler handles this case and does not re-evaluate. This caused a subtle bug in my app when enabling the compiler.
Apologies if this is a duplicate, I looked but could not find similar.
Every time
19.2.4
1.0.0
Claim this issue to let others know you're working on it. You'll earn 15 points when you complete it!