({ step })
| 509 | const getSnapshotB = () => store.getState().b; |
| 510 | |
| 511 | function Child1({ step }) { |
| 512 | const value = useSyncExternalStore(store.subscribe, store.getState); |
| 513 | useLayoutEffect(() => { |
| 514 | if (step === 1) { |
| 515 | // Update B in a layout effect. This happens in the same commit |
| 516 | // that changed the getSnapshot in Child2. Child2's effects haven't |
| 517 | // fired yet, so it doesn't have access to the latest getSnapshot. So |
| 518 | // it can't use the getSnapshot to bail out. |
| 519 | Scheduler.log('Update B in commit phase'); |
| 520 | store.set({ a: value.a, b: 2 }); |
| 521 | } |
| 522 | }, [step]); |
| 523 | return null; |
| 524 | } |
| 525 | |
| 526 | function Child2({ step }) { |
| 527 | const label = step === 0 ? 'A' : 'B'; |
nothing calls this directly
no test coverage detected
searching dependent graphs…