Skip to content

Conversation

@sebmarkbage
Copy link
Collaborator

Currently we always clone the root when a gesture transition happens. The was to add an optimization where if a Transition could be isolated to an absolutely positioned subtree then we could just clone that subtree or just do a plain insertion if it was simple an Enter. That way when switching between two absolutely positioned pages the shell wouldn't need to be cloned. In that case detectMutationOrInsertClones would return false. However, currently it always return true because we don't yet have that optimization.

The idea was to warn when the root required cloning to ensure that you optimize it intentionally since it's easy to accidentally update more than necessary. However, since this is not yet actionable I'm removing this warning for now.

Instead, I add a warning for particularly bad cases where you really shouldn't clone like iframe and video. They may not be very actionable without the optimization since you can't scope it down to a subtree without the optimization. So if they're above the gesture then they're always cloned atm. However, it might also be that it's unnecessary to keep them mounted if they could be removed or hidden with Activity.

@meta-cla meta-cla bot added the CLA Signed label Jan 19, 2026
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Jan 19, 2026
@react-sizebot
Copy link

Comparing: 41b3e9a...87cbefe

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.84 kB 6.84 kB = 1.88 kB 1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 608.48 kB 608.48 kB = 107.60 kB 107.60 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.84 kB 6.84 kB = 1.88 kB 1.88 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 670.95 kB 670.95 kB = 118.02 kB 118.02 kB
facebook-www/ReactDOM-prod.classic.js = 693.87 kB 693.87 kB = 121.97 kB 121.97 kB
facebook-www/ReactDOM-prod.modern.js = 684.25 kB 684.25 kB = 120.37 kB 120.37 kB
oss-experimental/react-server/cjs/react-server.development.js = 214.39 kB 209.99 kB = 37.90 kB 37.10 kB
oss-stable-semver/react-server/cjs/react-server.development.js = 209.60 kB 205.20 kB = 36.97 kB 36.17 kB
oss-stable/react-server/cjs/react-server.development.js = 209.60 kB 205.20 kB = 36.97 kB 36.17 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-markup/cjs/react-markup.react-server.development.js = 672.86 kB 668.57 kB = 119.15 kB 118.34 kB
oss-experimental/react-dom/cjs/react-dom-server.node.development.js = 460.87 kB 456.48 kB = 80.35 kB 79.49 kB
oss-experimental/react-dom/cjs/react-dom-server.edge.development.js = 455.11 kB 450.72 kB = 80.59 kB 79.73 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.development.js = 454.11 kB 449.71 kB = 80.36 kB 79.50 kB
oss-stable/react-dom/cjs/react-dom-server.node.development.js = 444.86 kB 440.47 kB = 78.09 kB 77.21 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.development.js = 444.79 kB 440.39 kB = 78.04 kB 77.16 kB
oss-experimental/react-dom/cjs/react-dom-server.bun.development.js = 402.04 kB 398.06 kB = 75.91 kB 75.08 kB
oss-stable/react-dom/cjs/react-dom-server.edge.development.js = 438.60 kB 434.21 kB = 78.29 kB 77.41 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.development.js = 438.53 kB 434.13 kB = 78.24 kB 77.37 kB
oss-stable/react-dom/cjs/react-dom-server.browser.development.js = 437.82 kB 433.43 kB = 78.10 kB 77.24 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.development.js = 437.75 kB 433.35 kB = 78.05 kB 77.20 kB
oss-stable/react-dom/cjs/react-dom-server.bun.development.js = 387.88 kB 383.90 kB = 73.59 kB 72.79 kB
oss-stable-semver/react-dom/cjs/react-dom-server.bun.development.js = 387.81 kB 383.83 kB = 73.56 kB 72.76 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.development.js = 423.72 kB 419.33 kB = 76.15 kB 75.32 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.development.js = 423.72 kB 419.32 kB = 76.15 kB 75.32 kB
facebook-www/ReactDOMServer-dev.classic.js = 422.74 kB 418.34 kB = 75.89 kB 75.05 kB
facebook-www/ReactDOMServer-dev.modern.js = 419.30 kB 414.90 kB = 75.29 kB 74.45 kB
facebook-www/ReactDOMServerStreaming-dev.modern.js = 417.81 kB 413.41 kB = 74.83 kB 74.02 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.development.js = 408.43 kB 404.03 kB = 73.92 kB 73.10 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.development.js = 408.43 kB 404.03 kB = 73.93 kB 73.10 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.development.js = 408.40 kB 404.01 kB = 73.90 kB 73.07 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.development.js = 408.40 kB 404.01 kB = 73.90 kB 73.07 kB
oss-experimental/react-markup/cjs/react-markup.development.js = 395.45 kB 391.18 kB = 71.81 kB 71.05 kB
oss-experimental/react-server/cjs/react-server.development.js = 214.39 kB 209.99 kB = 37.90 kB 37.10 kB
oss-stable-semver/react-server/cjs/react-server.development.js = 209.60 kB 205.20 kB = 36.97 kB 36.17 kB
oss-stable/react-server/cjs/react-server.development.js = 209.60 kB 205.20 kB = 36.97 kB 36.17 kB

Generated by 🚫 dangerJS against 87cbefe

@sebmarkbage sebmarkbage merged commit d343c39 into facebook:main Jan 20, 2026
240 checks passed
github-actions bot pushed a commit that referenced this pull request Jan 20, 2026
Currently we always clone the root when a gesture transition happens.
The was to add an optimization where if a Transition could be isolated
to an absolutely positioned subtree then we could just clone that
subtree or just do a plain insertion if it was simple an Enter. That way
when switching between two absolutely positioned pages the shell
wouldn't need to be cloned. In that case `detectMutationOrInsertClones`
would return false. However, currently it always return true because we
don't yet have that optimization.

The idea was to warn when the root required cloning to ensure that you
optimize it intentionally since it's easy to accidentally update more
than necessary. However, since this is not yet actionable I'm removing
this warning for now.

Instead, I add a warning for particularly bad cases where you really
shouldn't clone like iframe and video. They may not be very actionable
without the optimization since you can't scope it down to a subtree
without the optimization. So if they're above the gesture then they're
always cloned atm. However, it might also be that it's unnecessary to
keep them mounted if they could be removed or hidden with Activity.

DiffTrain build for [d343c39](d343c39)
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.

3 participants