-
Notifications
You must be signed in to change notification settings - Fork 50.3k
Partial Hydration #14717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Partial Hydration #14717
Changes from 1 commit
bc3e2f9
433e6e5
2d28a52
f06a540
97a6664
1b3e0a2
6febcae
7af0b8a
dac0688
92fb62a
6ae914c
e144a5e
eb3ea2d
97eb545
c91092b
2e16dc1
1db9dd2
3a89f65
e0e1ded
ca2d628
34a132c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Will be used for Suspense boundaries that are left with their server rendered content intact.
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ import { | |
| HostPortal, | ||
| ContextProvider, | ||
| SuspenseComponent, | ||
| DehydratedSuspenseComponent, | ||
| IncompleteClassComponent, | ||
| } from 'shared/ReactWorkTags'; | ||
| import { | ||
|
|
@@ -36,7 +37,10 @@ import { | |
| } from 'shared/ReactSideEffectTags'; | ||
| import {enableSchedulerTracing} from 'shared/ReactFeatureFlags'; | ||
| import {ConcurrentMode} from './ReactTypeOfMode'; | ||
| import {shouldCaptureSuspense} from './ReactFiberSuspenseComponent'; | ||
| import { | ||
| shouldCaptureSuspense, | ||
| shouldCaptureDehydratedSuspense, | ||
| } from './ReactFiberSuspenseComponent'; | ||
|
|
||
| import {createCapturedValue} from './ReactCapturedValue'; | ||
| import { | ||
|
|
@@ -197,6 +201,8 @@ function throwException( | |
| earliestTimeoutMs = timeoutPropMs; | ||
| } | ||
| } | ||
| } else if (workInProgress.tag === DehydratedSuspenseComponent) { | ||
| // TODO | ||
sebmarkbage marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| workInProgress = workInProgress.return; | ||
| } while (workInProgress !== null); | ||
|
|
@@ -334,6 +340,12 @@ function throwException( | |
| workInProgress.effectTag |= ShouldCapture; | ||
| workInProgress.expirationTime = renderExpirationTime; | ||
| return; | ||
| } else if ( | ||
| workInProgress.tag === DehydratedSuspenseComponent && | ||
| shouldCaptureDehydratedSuspense(workInProgress) | ||
| ) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this branch doesn't suspend (it doesn't call
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. What happens is that only the first path schedules remaining work at "Never" expiration time. Then if it throws, it doesn't suspend but it also doesn't leave any work on it. Instead it commits. Then it waits for the retry. The retry gets scheduled at normal priority. If that update also throws a promise, then it commits in the dehydrated state again and waits for the retry.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see so when something suspends inside a dehydrated Suspense boundary it always bails out and clears the expiration time. The ping/retry adds the expiration time back. There’s no need to suspend the commit because it’s not blocking anything. |
||
| // TODO | ||
| return; | ||
| } | ||
| // This boundary already captured during this render. Continue to the next | ||
| // boundary. | ||
|
|
@@ -432,6 +444,7 @@ function unwindWork( | |
| return workInProgress; | ||
| } | ||
| case HostComponent: { | ||
| // TODO: popHydrationState | ||
| popHostContext(workInProgress); | ||
| return null; | ||
| } | ||
|
|
@@ -444,6 +457,11 @@ function unwindWork( | |
| } | ||
| return null; | ||
| } | ||
| case DehydratedSuspenseComponent: { | ||
| // TODO: popHydrationState | ||
| // TODO: Maybe re-render if it captured? | ||
| return null; | ||
| } | ||
| case HostPortal: | ||
| popHostContainer(workInProgress); | ||
| return null; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.