Skip to content

[Fiber] Schedule client renders using non-hydration lane #31776

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

Merged
merged 2 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions packages/react-reconciler/src/ReactFiberBeginWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ import {
disableLegacyMode,
disableDefaultPropsExceptForClasses,
enableOwnerStacks,
enableHydrationLaneScheduling,
} from 'shared/ReactFeatureFlags';
import isArray from 'shared/isArray';
import shallowEqual from 'shared/shallowEqual';
Expand Down Expand Up @@ -146,6 +147,7 @@ import {
NoLane,
NoLanes,
OffscreenLane,
DefaultLane,
DefaultHydrationLane,
SomeRetryLane,
includesSomeLane,
Expand Down Expand Up @@ -2646,14 +2648,10 @@ function mountDehydratedSuspenseComponent(
// have timed out. In theory we could render it in this pass but it would have the
// wrong priority associated with it and will prevent hydration of parent path.
// Instead, we'll leave work left on it to render it in a separate commit.

// TODO This time should be the time at which the server rendered response that is
// a parent to this boundary was displayed. However, since we currently don't have
// a protocol to transfer that time, we'll just estimate it by using the current
// time. This will mean that Suspense timeouts are slightly shifted to later than
// they should be.
// Schedule a normal pri update to render this content.
workInProgress.lanes = laneToLanes(DefaultHydrationLane);
workInProgress.lanes = laneToLanes(
enableHydrationLaneScheduling ? DefaultLane : DefaultHydrationLane,
Copy link
Collaborator Author

@sebmarkbage sebmarkbage Dec 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use the same kill switch even though this case is using the hydration lane less than before. Unlike the other change which is the inverse of this in the cases where it is doing hydration.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this lower the priority below other things hydrating (maybe that's the intent) or is there a timeout or something that forces it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sync unification is not complete so the semantics there are kind of nonsensical atm in edge cases.

In general in the model I don't think it should be possible to have other work on the default hydration lane already since that would've already been done if we're hydrating at lower priority or if there is some then that's because we're currently doing it.

The only thing is that it might be batched with other default lane work like updates which might delay the commit but that's also kind of the point that if that work interleaves with this work then we shouldn't have to rewind.

);
} else {
// We'll continue hydrating the rest at offscreen priority since we'll already
// be showing the right content coming from the server, it is no rush.
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/ReactFeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
// when it rolls out to prod. We should remove these as soon as possible.
// -----------------------------------------------------------------------------

export const enableHydrationLaneScheduling = true;

// -----------------------------------------------------------------------------
// Land or remove (moderate effort)
//
Expand Down Expand Up @@ -113,8 +115,6 @@ export const enableSuspenseAvoidThisFallbackFizz = false;

export const enableCPUSuspense = __EXPERIMENTAL__;

export const enableHydrationLaneScheduling = true;

// Test this at Meta before enabling.
export const enableNoCloningMemoCache = false;

Expand Down
Loading