Commit 84ee4d4
Fix cascading update (#54438)
Summary:
Pull Request resolved: #54438
# Changelog: [Internal]
`LogBoxStateSubscription` subscribed to state updates in a mount effect. This callback could be called instantly on subscription initiation, which would cause a cascading update => setState in mount effect [1].
This diff changes the approach, the state is initialized before mount and the callback is not called synchronously on initialization. I had to keep `observe` function as it is right now, because it is used extensively in tests.
Reviewed By: javache
Differential Revision: D86449266
fbshipit-source-id: c7a2cffec760e697d8b5525e88997204b16fcd811 parent 2a1e12f commit 84ee4d4
1 file changed
Lines changed: 31 additions & 4 deletions
Lines changed: 31 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
415 | 430 | | |
416 | 431 | | |
417 | 432 | | |
| |||
447 | 462 | | |
448 | 463 | | |
449 | 464 | | |
| 465 | + | |
450 | 466 | | |
451 | 467 | | |
452 | | - | |
453 | | - | |
454 | 468 | | |
455 | | - | |
| 469 | + | |
456 | 470 | | |
457 | 471 | | |
458 | 472 | | |
| |||
472 | 486 | | |
473 | 487 | | |
474 | 488 | | |
475 | | - | |
| 489 | + | |
476 | 490 | | |
477 | 491 | | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
478 | 501 | | |
479 | 502 | | |
480 | 503 | | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
481 | 508 | | |
482 | 509 | | |
483 | 510 | | |
| |||
0 commit comments