Commit a9061e9
YASHRDX0001
Fix: set-state-in-use-effect false negative when there are multiple instances
Fixes issue #35291 where the ESLint rule was not catching setState calls in effect callbacks when a component had multiple useState and useEffect hooks.
The issue was an overly strict optimization check that skipped analyzing some function expressions. Now all function expressions are properly analyzed for setState calls.
Changes:
- Removed the faulty optimization check in validateNoSetStateInEffects
- Added test fixture to prevent regressions1 parent 378973b commit a9061e9
File tree
2 files changed
+23
-16
lines changed- compiler/packages/babel-plugin-react-compiler/src
- Validation
- __tests__/fixtures/compiler
2 files changed
+23
-16
lines changedLines changed: 7 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
93 | 84 | | |
94 | 85 | | |
95 | 86 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
0 commit comments