KEMBAR78
[Fiber] Wait for suspensey image in the viewport before starting an animation by sebmarkbage · Pull Request #34500 · facebook/react · GitHub
Skip to content

Conversation

@sebmarkbage
Copy link
Collaborator

Stacked on #34486.

If we gave up on loading suspensey images for blocking the commit (e.g. due to #34481), we can still block the view transition from committing to allow an animation to include the image from the start.

At this point we have more information about the layout so we can include only the images that are within viewport in the calculation which may end up with a different answer.

This only applies when we attempt to run an animation (e.g. something mutated inside a <ViewTransition> in a Transition). We could attempt a startViewTransition if we gave up on the suspensey images just so that we could block it even if no animation would be running.

However, this point the screen is frozen and you can no longer have sync updates interrupt so ideally we would have already blocked the commit from happening in the first place.

The reason to have two points where we block is that ideally we leave the UI responsive while blocking, which blocking the commit does. In the simple case of all images or a single image being within the viewport, that's favorable. By combining the techniques we only end up freezing the screen in the special case that we had a lot of images added outside the viewport and started an animation with some image inside the viewport (which presumably is about to finish anyway).

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

react-sizebot commented Sep 15, 2025

Comparing: 5d49b2b...99f5a36

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 = 534.29 kB 534.32 kB = 94.32 kB 94.32 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.22% 662.18 kB 663.64 kB +0.28% 116.68 kB 117.01 kB
facebook-www/ReactDOM-prod.classic.js +0.21% 686.13 kB 687.59 kB +0.28% 120.71 kB 121.04 kB
facebook-www/ReactDOM-prod.modern.js +0.22% 676.56 kB 678.02 kB +0.28% 119.05 kB 119.39 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/cjs/react-dom-client.production.js +0.22% 662.18 kB 663.64 kB +0.28% 116.68 kB 117.01 kB
facebook-www/ReactDOM-prod.modern.js +0.22% 676.56 kB 678.02 kB +0.28% 119.05 kB 119.39 kB
oss-experimental/react-dom/cjs/react-dom-unstable_testing.production.js +0.22% 676.59 kB 678.05 kB +0.27% 120.24 kB 120.57 kB
facebook-www/ReactDOM-prod.classic.js +0.21% 686.13 kB 687.59 kB +0.28% 120.71 kB 121.04 kB
facebook-www/ReactDOMTesting-prod.modern.js +0.21% 690.96 kB 692.42 kB +0.27% 122.64 kB 122.98 kB
facebook-www/ReactDOMTesting-prod.classic.js +0.21% 700.53 kB 701.99 kB +0.27% 124.28 kB 124.62 kB
oss-experimental/react-dom/cjs/react-dom-profiling.profiling.js +0.20% 727.79 kB 729.25 kB +0.25% 126.36 kB 126.68 kB

Generated by 🚫 dangerJS against 99f5a36

If we gave up on loading suspensey images for blocking the commit, we can
still block the view transition from committing to allow an animation to
include the image from the start.

At this point we have more information about the layout so we can include
only the images that are within viewport in the calculation which may
end up with a different answer.
@sebmarkbage sebmarkbage merged commit 348a4e2 into facebook:main Sep 15, 2025
241 checks passed
github-actions bot pushed a commit that referenced this pull request Sep 15, 2025
…nimation (#34500)

Stacked on #34486.

If we gave up on loading suspensey images for blocking the commit (e.g.
due to #34481), we can still block the view transition from committing
to allow an animation to include the image from the start.

At this point we have more information about the layout so we can
include only the images that are within viewport in the calculation
which may end up with a different answer.

This only applies when we attempt to run an animation (e.g. something
mutated inside a `<ViewTransition>` in a Transition). We could attempt a
`startViewTransition` if we gave up on the suspensey images just so that
we could block it even if no animation would be running.

However, this point the screen is frozen and you can no longer have sync
updates interrupt so ideally we would have already blocked the commit
from happening in the first place.

The reason to have two points where we block is that ideally we leave
the UI responsive while blocking, which blocking the commit does. In the
simple case of all images or a single image being within the viewport,
that's favorable. By combining the techniques we only end up freezing
the screen in the special case that we had a lot of images added outside
the viewport and started an animation with some image inside the
viewport (which presumably is about to finish anyway).

DiffTrain build for [348a4e2](348a4e2)
github-actions bot pushed a commit that referenced this pull request Sep 15, 2025
…nimation (#34500)

Stacked on #34486.

If we gave up on loading suspensey images for blocking the commit (e.g.
due to #34481), we can still block the view transition from committing
to allow an animation to include the image from the start.

At this point we have more information about the layout so we can
include only the images that are within viewport in the calculation
which may end up with a different answer.

This only applies when we attempt to run an animation (e.g. something
mutated inside a `<ViewTransition>` in a Transition). We could attempt a
`startViewTransition` if we gave up on the suspensey images just so that
we could block it even if no animation would be running.

However, this point the screen is frozen and you can no longer have sync
updates interrupt so ideally we would have already blocked the commit
from happening in the first place.

The reason to have two points where we block is that ideally we leave
the UI responsive while blocking, which blocking the commit does. In the
simple case of all images or a single image being within the viewport,
that's favorable. By combining the techniques we only end up freezing
the screen in the special case that we had a lot of images added outside
the viewport and started an animation with some image inside the
viewport (which presumably is about to finish anyway).

DiffTrain build for [348a4e2](348a4e2)
github-actions bot pushed a commit to code/lib-react that referenced this pull request Sep 20, 2025
…nimation (facebook#34500)

Stacked on facebook#34486.

If we gave up on loading suspensey images for blocking the commit (e.g.
due to facebook#34481), we can still block the view transition from committing
to allow an animation to include the image from the start.

At this point we have more information about the layout so we can
include only the images that are within viewport in the calculation
which may end up with a different answer.

This only applies when we attempt to run an animation (e.g. something
mutated inside a `<ViewTransition>` in a Transition). We could attempt a
`startViewTransition` if we gave up on the suspensey images just so that
we could block it even if no animation would be running.

However, this point the screen is frozen and you can no longer have sync
updates interrupt so ideally we would have already blocked the commit
from happening in the first place.

The reason to have two points where we block is that ideally we leave
the UI responsive while blocking, which blocking the commit does. In the
simple case of all images or a single image being within the viewport,
that's favorable. By combining the techniques we only end up freezing
the screen in the special case that we had a lot of images added outside
the viewport and started an animation with some image inside the
viewport (which presumably is about to finish anyway).

DiffTrain build for [348a4e2](facebook@348a4e2)
github-actions bot pushed a commit to code/lib-react that referenced this pull request Sep 20, 2025
…nimation (facebook#34500)

Stacked on facebook#34486.

If we gave up on loading suspensey images for blocking the commit (e.g.
due to facebook#34481), we can still block the view transition from committing
to allow an animation to include the image from the start.

At this point we have more information about the layout so we can
include only the images that are within viewport in the calculation
which may end up with a different answer.

This only applies when we attempt to run an animation (e.g. something
mutated inside a `<ViewTransition>` in a Transition). We could attempt a
`startViewTransition` if we gave up on the suspensey images just so that
we could block it even if no animation would be running.

However, this point the screen is frozen and you can no longer have sync
updates interrupt so ideally we would have already blocked the commit
from happening in the first place.

The reason to have two points where we block is that ideally we leave
the UI responsive while blocking, which blocking the commit does. In the
simple case of all images or a single image being within the viewport,
that's favorable. By combining the techniques we only end up freezing
the screen in the special case that we had a lot of images added outside
the viewport and started an animation with some image inside the
viewport (which presumably is about to finish anyway).

DiffTrain build for [348a4e2](facebook@348a4e2)
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