Skip to content

Conversation

sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented Apr 9, 2025

Stacked on #32851 and #32900.

This implements the equivalent Configs for ActivityInstance as we have for SuspenseInstance. These can be implemented as comments but they don't have to be and can be implemented differently in the renderer.

This seems like a lot duplication but it's actually ends mostly just calling the same methods underneath and the wrappers compiles out.

This doesn't leave the Activity dehydrated yet. It just hydrates into it immediately.

// Returns the SuspenseInstance if this node is a direct child of a
// SuspenseInstance. I.e. if its previous sibling is a Comment with
// SUSPENSE_x_START_DATA. Otherwise, null.
export function getParentSuspenseInstance(
export function getParentHydrationBoundary(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This isn't actually part of the Config. It's used by the DOM bindings themselves.

@react-sizebot
Copy link

react-sizebot commented Apr 9, 2025

Comparing: ebf7318...54a9f32

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB = 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js +0.26% 517.56 kB 518.90 kB +0.19% 92.09 kB 92.27 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js +0.21% 623.42 kB 624.75 kB +0.18% 110.27 kB 110.46 kB
facebook-www/ReactDOM-prod.classic.js +0.20% 656.84 kB 658.15 kB +0.17% 115.81 kB 116.01 kB
facebook-www/ReactDOM-prod.modern.js +0.20% 647.12 kB 648.43 kB +0.16% 114.28 kB 114.46 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react-dom/unstable_server-external-runtime.js +1.28% 8.69 kB 8.80 kB +0.80% 2.26 kB 2.28 kB
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.development.js +1.21% 6.84 kB 6.92 kB +0.97% 1.65 kB 1.66 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.development.js +1.21% 6.84 kB 6.92 kB +0.97% 1.65 kB 1.66 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.development.js +1.21% 6.84 kB 6.92 kB +0.97% 1.65 kB 1.66 kB
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.production.js +1.15% 6.19 kB 6.26 kB +1.04% 1.64 kB 1.66 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.production.js +1.15% 6.19 kB 6.26 kB +1.04% 1.64 kB 1.66 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.production.js +1.15% 6.19 kB 6.26 kB +1.04% 1.64 kB 1.66 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler.production.js +0.33% 392.09 kB 393.40 kB +0.28% 63.78 kB 63.96 kB
oss-stable/react-reconciler/cjs/react-reconciler.production.js +0.33% 392.12 kB 393.42 kB +0.29% 63.80 kB 63.98 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler.profiling.js +0.31% 420.49 kB 421.79 kB +0.26% 67.64 kB 67.81 kB
oss-stable/react-reconciler/cjs/react-reconciler.profiling.js +0.31% 420.51 kB 421.82 kB +0.25% 67.66 kB 67.83 kB
oss-experimental/react-reconciler/cjs/react-reconciler.production.js +0.28% 464.96 kB 466.27 kB +0.25% 74.70 kB 74.88 kB
facebook-www/ReactReconciler-prod.modern.js +0.27% 488.06 kB 489.38 kB +0.22% 78.45 kB 78.62 kB
facebook-www/ReactReconciler-prod.classic.js +0.27% 498.36 kB 499.69 kB +0.20% 80.06 kB 80.21 kB
oss-stable-semver/react-dom/cjs/react-dom-client.production.js +0.26% 517.44 kB 518.77 kB +0.19% 92.07 kB 92.24 kB
oss-stable/react-dom/cjs/react-dom-client.production.js +0.26% 517.56 kB 518.90 kB +0.19% 92.09 kB 92.27 kB
facebook-react-native/react-dom/cjs/ReactDOMClient-prod.js +0.25% 541.64 kB 543.02 kB +0.20% 95.99 kB 96.18 kB
facebook-react-native/react-dom/cjs/ReactDOMProfiling-prod.js +0.25% 547.15 kB 548.53 kB +0.20% 97.07 kB 97.27 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler.development.js +0.25% 650.81 kB 652.43 kB +0.18% 103.74 kB 103.93 kB
oss-stable/react-reconciler/cjs/react-reconciler.development.js +0.25% 650.83 kB 652.46 kB +0.18% 103.77 kB 103.96 kB
oss-experimental/react-reconciler/cjs/react-reconciler.profiling.js +0.25% 526.95 kB 528.26 kB +0.25% 83.48 kB 83.69 kB
oss-stable-semver/react-dom/cjs/react-dom-profiling.profiling.js +0.24% 550.33 kB 551.67 kB +0.20% 96.95 kB 97.15 kB
oss-stable/react-dom/cjs/react-dom-profiling.profiling.js +0.24% 550.46 kB 551.79 kB +0.20% 96.98 kB 97.17 kB
facebook-react-native/react-dom/cjs/ReactDOMClient-profiling.js +0.24% 569.07 kB 570.45 kB +0.19% 99.93 kB 100.12 kB
facebook-www/ReactReconciler-dev.modern.js +0.24% 815.41 kB 817.37 kB +0.19% 127.39 kB 127.62 kB
facebook-react-native/react-dom/cjs/ReactDOMProfiling-profiling.js +0.24% 575.01 kB 576.39 kB +0.19% 101.09 kB 101.28 kB
facebook-www/ReactReconciler-dev.classic.js +0.24% 824.61 kB 826.57 kB +0.19% 129.10 kB 129.35 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js +0.21% 623.42 kB 624.75 kB +0.18% 110.27 kB 110.46 kB
oss-experimental/react-dom/cjs/react-dom-unstable_testing.production.js +0.21% 637.83 kB 639.17 kB +0.17% 113.84 kB 114.04 kB
oss-experimental/react-reconciler/cjs/react-reconciler.development.js +0.21% 775.26 kB 776.88 kB +0.15% 121.83 kB 122.01 kB
facebook-www/ReactDOM-prod.modern.js +0.20% 647.12 kB 648.43 kB +0.16% 114.28 kB 114.46 kB
facebook-www/ReactDOM-prod.classic.js +0.20% 656.84 kB 658.15 kB +0.17% 115.81 kB 116.01 kB

Generated by 🚫 dangerJS against 54a9f32

Copy link
Member

@rickhanlonii rickhanlonii left a comment

Choose a reason for hiding this comment

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

Tests will come when we actually keep it dehydrated?

@sebmarkbage sebmarkbage merged commit 17f88c8 into facebook:main Apr 22, 2025
238 of 239 checks passed
github-actions bot pushed a commit that referenced this pull request Apr 22, 2025
Stacked on #32851 and #32900.

This implements the equivalent Configs for ActivityInstance as we have
for SuspenseInstance. These can be implemented as comments but they
don't have to be and can be implemented differently in the renderer.

This seems like a lot duplication but it's actually ends mostly just
calling the same methods underneath and the wrappers compiles out.

This doesn't leave the Activity dehydrated yet. It just hydrates into it
immediately.

DiffTrain build for [17f88c8](17f88c8)
github-actions bot pushed a commit that referenced this pull request Apr 22, 2025
Stacked on #32851 and #32900.

This implements the equivalent Configs for ActivityInstance as we have
for SuspenseInstance. These can be implemented as comments but they
don't have to be and can be implemented differently in the renderer.

This seems like a lot duplication but it's actually ends mostly just
calling the same methods underneath and the wrappers compiles out.

This doesn't leave the Activity dehydrated yet. It just hydrates into it
immediately.

DiffTrain build for [17f88c8](17f88c8)
sebmarkbage added a commit that referenced this pull request Apr 23, 2025
Stacked on #32862 and #32842.

This means that Activity boundaries now act as boundaries which can have
their effects mounted independently. Just like Suspense boundaries, we
hydrate the outer content first and then start hydrating the content in
an Offscreen lane. Flowing props or interacting with the content
increases the priority just like Suspense boundaries.

This skips emitting even the comments for `<Activity mode="hidden">` so
we don't hydrate those. Instead those are deferred to a later client
render.

The implementation are just forked copies of the SuspenseComponent
branches and then carefully going through each line and tweaking it.

The main interesting bit is that, unlike Suspense, Activity boundaries
don't have fallbacks so all those branches where you might commit a
suspended tree disappears. Instead, if something suspends while
hydration, we can just leave the dehydrated content in place. However,
if something does suspend during client rendering then it should bubble
up to the parent. Therefore, we have to be careful to only
pushSuspenseHandler when hydrating. That's really the main difference.

This just uses the existing basic Activity tests but I've started work
on port all of the applicable Suspense tests in SelectiveHydration-test
and PartialHydration-test to Activity versions.
github-actions bot pushed a commit that referenced this pull request Apr 23, 2025
Stacked on #32862 and #32842.

This means that Activity boundaries now act as boundaries which can have
their effects mounted independently. Just like Suspense boundaries, we
hydrate the outer content first and then start hydrating the content in
an Offscreen lane. Flowing props or interacting with the content
increases the priority just like Suspense boundaries.

This skips emitting even the comments for `<Activity mode="hidden">` so
we don't hydrate those. Instead those are deferred to a later client
render.

The implementation are just forked copies of the SuspenseComponent
branches and then carefully going through each line and tweaking it.

The main interesting bit is that, unlike Suspense, Activity boundaries
don't have fallbacks so all those branches where you might commit a
suspended tree disappears. Instead, if something suspends while
hydration, we can just leave the dehydrated content in place. However,
if something does suspend during client rendering then it should bubble
up to the parent. Therefore, we have to be careful to only
pushSuspenseHandler when hydrating. That's really the main difference.

This just uses the existing basic Activity tests but I've started work
on port all of the applicable Suspense tests in SelectiveHydration-test
and PartialHydration-test to Activity versions.

DiffTrain build for [3ef31d1](3ef31d1)
github-actions bot pushed a commit that referenced this pull request Apr 23, 2025
Stacked on #32862 and #32842.

This means that Activity boundaries now act as boundaries which can have
their effects mounted independently. Just like Suspense boundaries, we
hydrate the outer content first and then start hydrating the content in
an Offscreen lane. Flowing props or interacting with the content
increases the priority just like Suspense boundaries.

This skips emitting even the comments for `<Activity mode="hidden">` so
we don't hydrate those. Instead those are deferred to a later client
render.

The implementation are just forked copies of the SuspenseComponent
branches and then carefully going through each line and tweaking it.

The main interesting bit is that, unlike Suspense, Activity boundaries
don't have fallbacks so all those branches where you might commit a
suspended tree disappears. Instead, if something suspends while
hydration, we can just leave the dehydrated content in place. However,
if something does suspend during client rendering then it should bubble
up to the parent. Therefore, we have to be careful to only
pushSuspenseHandler when hydrating. That's really the main difference.

This just uses the existing basic Activity tests but I've started work
on port all of the applicable Suspense tests in SelectiveHydration-test
and PartialHydration-test to Activity versions.

DiffTrain build for [3ef31d1](3ef31d1)
github-actions bot pushed a commit to code/lib-react that referenced this pull request Apr 23, 2025
Stacked on facebook#32851 and facebook#32900.

This implements the equivalent Configs for ActivityInstance as we have
for SuspenseInstance. These can be implemented as comments but they
don't have to be and can be implemented differently in the renderer.

This seems like a lot duplication but it's actually ends mostly just
calling the same methods underneath and the wrappers compiles out.

This doesn't leave the Activity dehydrated yet. It just hydrates into it
immediately.

DiffTrain build for [17f88c8](facebook@17f88c8)
github-actions bot pushed a commit to code/lib-react that referenced this pull request Apr 23, 2025
Stacked on facebook#32851 and facebook#32900.

This implements the equivalent Configs for ActivityInstance as we have
for SuspenseInstance. These can be implemented as comments but they
don't have to be and can be implemented differently in the renderer.

This seems like a lot duplication but it's actually ends mostly just
calling the same methods underneath and the wrappers compiles out.

This doesn't leave the Activity dehydrated yet. It just hydrates into it
immediately.

DiffTrain build for [17f88c8](facebook@17f88c8)
github-actions bot pushed a commit to code/lib-react that referenced this pull request Apr 23, 2025
Stacked on facebook#32862 and facebook#32842.

This means that Activity boundaries now act as boundaries which can have
their effects mounted independently. Just like Suspense boundaries, we
hydrate the outer content first and then start hydrating the content in
an Offscreen lane. Flowing props or interacting with the content
increases the priority just like Suspense boundaries.

This skips emitting even the comments for `<Activity mode="hidden">` so
we don't hydrate those. Instead those are deferred to a later client
render.

The implementation are just forked copies of the SuspenseComponent
branches and then carefully going through each line and tweaking it.

The main interesting bit is that, unlike Suspense, Activity boundaries
don't have fallbacks so all those branches where you might commit a
suspended tree disappears. Instead, if something suspends while
hydration, we can just leave the dehydrated content in place. However,
if something does suspend during client rendering then it should bubble
up to the parent. Therefore, we have to be careful to only
pushSuspenseHandler when hydrating. That's really the main difference.

This just uses the existing basic Activity tests but I've started work
on port all of the applicable Suspense tests in SelectiveHydration-test
and PartialHydration-test to Activity versions.

DiffTrain build for [3ef31d1](facebook@3ef31d1)
github-actions bot pushed a commit to code/lib-react that referenced this pull request Apr 23, 2025
Stacked on facebook#32862 and facebook#32842.

This means that Activity boundaries now act as boundaries which can have
their effects mounted independently. Just like Suspense boundaries, we
hydrate the outer content first and then start hydrating the content in
an Offscreen lane. Flowing props or interacting with the content
increases the priority just like Suspense boundaries.

This skips emitting even the comments for `<Activity mode="hidden">` so
we don't hydrate those. Instead those are deferred to a later client
render.

The implementation are just forked copies of the SuspenseComponent
branches and then carefully going through each line and tweaking it.

The main interesting bit is that, unlike Suspense, Activity boundaries
don't have fallbacks so all those branches where you might commit a
suspended tree disappears. Instead, if something suspends while
hydration, we can just leave the dehydrated content in place. However,
if something does suspend during client rendering then it should bubble
up to the parent. Therefore, we have to be careful to only
pushSuspenseHandler when hydrating. That's really the main difference.

This just uses the existing basic Activity tests but I've started work
on port all of the applicable Suspense tests in SelectiveHydration-test
and PartialHydration-test to Activity versions.

DiffTrain build for [3ef31d1](facebook@3ef31d1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants