Commit c2b5416
committed
[compiler] Add enableVerboseNoSetStateInEffect to suggest options to user/agent (facebook#35306)
The current `validateNoSetStateInEffects` error has potential false
positives because
we cannot fully statically detect patterns where calling setState in an
effect is
actually valid. This flag `enableVerboseNoSetStateInEffect` adds a
verbose error mode that presents multiple possible
use-cases, allowing an agent to reason about which fix is appropriate
before acting:
1. Non-local derived data - suggests restructuring state ownership
2. Derived event pattern - suggests requesting an event callback from
parent
3. Force update / external sync - suggests using `useSyncExternalStore`
This gives agents the context needed to make informed decisions rather
than
blindly applying a fix that may not be correct for the specific
situation.
DiffTrain build for [3640f38](facebook@3640f38)1 parent f511282 commit c2b5416
File tree
35 files changed
+448
-290
lines changed- compiled
- eslint-plugin-react-hooks
- facebook-www
35 files changed
+448
-290
lines changedLarge diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1499 | 1499 | | |
1500 | 1500 | | |
1501 | 1501 | | |
1502 | | - | |
| 1502 | + | |
1503 | 1503 | | |
1504 | 1504 | | |
1505 | 1505 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1499 | 1499 | | |
1500 | 1500 | | |
1501 | 1501 | | |
1502 | | - | |
| 1502 | + | |
1503 | 1503 | | |
1504 | 1504 | | |
1505 | 1505 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
606 | 606 | | |
607 | 607 | | |
608 | 608 | | |
609 | | - | |
| 609 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
606 | 606 | | |
607 | 607 | | |
608 | 608 | | |
609 | | - | |
| 609 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
613 | | - | |
| 613 | + | |
614 | 614 | | |
615 | 615 | | |
616 | 616 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
613 | | - | |
| 613 | + | |
614 | 614 | | |
615 | 615 | | |
616 | 616 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20468 | 20468 | | |
20469 | 20469 | | |
20470 | 20470 | | |
20471 | | - | |
| 20471 | + | |
20472 | 20472 | | |
20473 | 20473 | | |
20474 | | - | |
| 20474 | + | |
20475 | 20475 | | |
20476 | 20476 | | |
20477 | 20477 | | |
| |||
20506 | 20506 | | |
20507 | 20507 | | |
20508 | 20508 | | |
20509 | | - | |
| 20509 | + | |
20510 | 20510 | | |
20511 | 20511 | | |
20512 | 20512 | | |
| |||
0 commit comments