|
7 | 7 | * @noflow
|
8 | 8 | * @nolint
|
9 | 9 | * @preventMunge
|
10 |
| - * @generated SignedSource<<9b439e19fdffa2fa6e386a55c7f2dc88>> |
| 10 | + * @generated SignedSource<<959db6b7a430088709ef79d2031321cd>> |
11 | 11 | */
|
12 | 12 |
|
13 | 13 | 'use strict';
|
@@ -10583,15 +10583,39 @@ function useThenable(thenable) {
|
10583 | 10583 | thenableState = createThenableState();
|
10584 | 10584 | }
|
10585 | 10585 |
|
10586 |
| - var result = trackUsedThenable(thenableState, thenable, index); |
| 10586 | + var result = trackUsedThenable(thenableState, thenable, index); // When something suspends with `use`, we replay the component with the |
| 10587 | + // "re-render" dispatcher instead of the "mount" or "update" dispatcher. |
| 10588 | + // |
| 10589 | + // But if there are additional hooks that occur after the `use` invocation |
| 10590 | + // that suspended, they wouldn't have been processed during the previous |
| 10591 | + // attempt. So after we invoke `use` again, we may need to switch from the |
| 10592 | + // "re-render" dispatcher back to the "mount" or "update" dispatcher. That's |
| 10593 | + // what the following logic accounts for. |
| 10594 | + // |
| 10595 | + // TODO: Theoretically this logic only needs to go into the rerender |
| 10596 | + // dispatcher. Could optimize, but probably not be worth it. |
| 10597 | + // This is the same logic as in updateWorkInProgressHook. |
| 10598 | + |
| 10599 | + var workInProgressFiber = currentlyRenderingFiber$1; |
| 10600 | + var nextWorkInProgressHook = workInProgressHook === null ? // We're at the beginning of the list, so read from the first hook from |
| 10601 | + // the fiber. |
| 10602 | + workInProgressFiber.memoizedState : workInProgressHook.next; |
| 10603 | + |
| 10604 | + if (nextWorkInProgressHook !== null) ; else { |
| 10605 | + // There are no remaining hooks from the previous attempt. We're no longer |
| 10606 | + // in "re-render" mode. Switch to the normal mount or update dispatcher. |
| 10607 | + // |
| 10608 | + // This is the same as the logic in renderWithHooks, except we don't bother |
| 10609 | + // to track the hook types debug information in this case (sufficient to |
| 10610 | + // only do that when nothing suspends). |
| 10611 | + var currentFiber = workInProgressFiber.alternate; |
10587 | 10612 |
|
10588 |
| - if (currentlyRenderingFiber$1.alternate === null && (workInProgressHook === null ? currentlyRenderingFiber$1.memoizedState === null : workInProgressHook.next === null)) { |
10589 |
| - // Initial render, and either this is the first time the component is |
10590 |
| - // called, or there were no Hooks called after this use() the previous |
10591 |
| - // time (perhaps because it threw). Subsequent Hook calls should use the |
10592 |
| - // mount dispatcher. |
10593 | 10613 | {
|
10594 |
| - ReactSharedInternals.H = HooksDispatcherOnMountInDEV; |
| 10614 | + if (currentFiber !== null && currentFiber.memoizedState !== null) { |
| 10615 | + ReactSharedInternals.H = HooksDispatcherOnUpdateInDEV; |
| 10616 | + } else { |
| 10617 | + ReactSharedInternals.H = HooksDispatcherOnMountInDEV; |
| 10618 | + } |
10595 | 10619 | }
|
10596 | 10620 | }
|
10597 | 10621 |
|
@@ -26206,7 +26230,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
|
26206 | 26230 | return root;
|
26207 | 26231 | }
|
26208 | 26232 |
|
26209 |
| -var ReactVersion = '19.0.0-rc-5c420e3824-20240531'; |
| 26233 | +var ReactVersion = '19.0.0-rc-adbec0c25a-20240531'; |
26210 | 26234 |
|
26211 | 26235 | /*
|
26212 | 26236 | * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
|
|
0 commit comments