Commit 2c5fd26
authored
[crud] Merge useResourceEffect into useEffect (#32205)
Merges the useResourceEffect API into useEffect while keeping the
underlying implementation the same. useResourceEffect will be removed in
the next diff.
To fork between behavior we rely on a `typeof` check for the updater or
destroy function in addition to the CRUD feature flag. This does now
have to be checked every time (instead of inlined statically like before
due to them being different hooks) which will incur some non-zero amount
(possibly negligble) of overhead for every effect.
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32205).
* #32206
* __->__ #322051 parent 0461c0d commit 2c5fd26
File tree
9 files changed
+296
-134
lines changed- packages
- react-debug-tools/src
- react-dom/src/__tests__
- react-reconciler/src
- __tests__
- react/src
- scripts/error-codes
9 files changed
+296
-134
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
373 | 373 | | |
374 | 374 | | |
375 | 375 | | |
376 | | - | |
377 | | - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
378 | 381 | | |
379 | 382 | | |
380 | 383 | | |
| |||
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
| |||
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
55 | | - | |
56 | 54 | | |
57 | 55 | | |
58 | 56 | | |
| |||
655 | 653 | | |
656 | 654 | | |
657 | 655 | | |
658 | | - | |
| 656 | + | |
659 | 657 | | |
660 | 658 | | |
661 | 659 | | |
662 | 660 | | |
663 | 661 | | |
664 | 662 | | |
665 | 663 | | |
666 | | - | |
| 664 | + | |
667 | 665 | | |
668 | 666 | | |
669 | 667 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
257 | | - | |
| 257 | + | |
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
174 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
| |||
261 | 262 | | |
262 | 263 | | |
263 | 264 | | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | 265 | | |
270 | 266 | | |
271 | 267 | | |
| |||
363 | 359 | | |
364 | 360 | | |
365 | 361 | | |
366 | | - | |
| 362 | + | |
367 | 363 | | |
368 | 364 | | |
369 | 365 | | |
| |||
1015 | 1011 | | |
1016 | 1012 | | |
1017 | 1013 | | |
1018 | | - | |
1019 | | - | |
1020 | | - | |
1021 | | - | |
1022 | | - | |
1023 | | - | |
1024 | | - | |
1025 | | - | |
1026 | | - | |
1027 | | - | |
1028 | | - | |
1029 | | - | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
1034 | | - | |
1035 | | - | |
1036 | | - | |
1037 | | - | |
1038 | | - | |
1039 | | - | |
1040 | | - | |
1041 | | - | |
| 1014 | + | |
| 1015 | + | |
1042 | 1016 | | |
1043 | | - | |
| 1017 | + | |
| 1018 | + | |
1044 | 1019 | | |
1045 | 1020 | | |
1046 | 1021 | | |
| |||
0 commit comments