Commit bbad60d
committed
Fix: use Object.is for dependency comparison to handle NaN correctly
Previously, the React Compiler generated code using !== for dependency
comparison, which doesn't match React's Object.is semantics. This caused
NaN in dependency arrays to always trigger re-evaluation since
NaN !== NaN is true, but Object.is(NaN, NaN) is true.
This fix changes the generated code to use !Object.is() for dependency
comparison, which correctly handles NaN and other edge cases like -0.
Fixes #358541 parent 1bb234c commit bbad60d
1 file changed
Lines changed: 15 additions & 7 deletions
Lines changed: 15 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
574 | 574 | | |
575 | 575 | | |
576 | 576 | | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
583 | 592 | | |
584 | | - | |
585 | 593 | | |
586 | 594 | | |
587 | 595 | | |
| |||
0 commit comments