Skip to content
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

Track separate SuspendedOnAction flag by rethrowing a separate SuspenseActionException sentinel #31554

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented Nov 15, 2024

This lets us track separately if something was suspended on an Action using useActionState rather than suspended on Data.

This approach feels quite bloated and it seems like we'd eventually might want to read more information about the Promise that suspended and the context it suspended in. As a more general reason for suspending.

The way useActionState works in combination with the prewarming is quite unfortunate because 1) it renders blocking to update the isPending flag whether you use it or not 2) it prewarms and suspends the useActionState 3) then it does another third render to get back into the useActionState position again.

…seActionException sentinel

This lets us track separately if something was suspended on an Action using useActionState.
Copy link

vercel bot commented Nov 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 15, 2024 8:43pm

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Nov 15, 2024
if (x === SuspenseException) {
// If we Suspend here, mark this separately so that we can track this
// as an Action in Profiling tools.
throw SuspenseActionException;
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 is where the magic happens.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah meh this is fine 😆

@react-sizebot
Copy link

Comparing: 0480cdb...bc6e288

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.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js +0.13% 509.08 kB 509.76 kB +0.12% 91.00 kB 91.11 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.13% 514.01 kB 514.69 kB +0.13% 91.71 kB 91.83 kB
facebook-www/ReactDOM-prod.classic.js +0.13% 588.65 kB 589.38 kB +0.12% 104.18 kB 104.30 kB
facebook-www/ReactDOM-prod.modern.js +0.13% 578.91 kB 579.65 kB +0.13% 102.59 kB 102.72 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable-rc/react-test-renderer/cjs/react-test-renderer.production.js +0.30% 308.29 kB 309.21 kB +0.18% 54.54 kB 54.64 kB
oss-stable-semver/react-test-renderer/cjs/react-test-renderer.production.js +0.30% 308.29 kB 309.21 kB +0.18% 54.54 kB 54.64 kB
oss-stable/react-test-renderer/cjs/react-test-renderer.production.js +0.30% 308.36 kB 309.27 kB +0.18% 54.56 kB 54.66 kB
oss-experimental/react-test-renderer/cjs/react-test-renderer.production.js +0.30% 308.54 kB 309.46 kB +0.19% 54.59 kB 54.70 kB
facebook-react-native/react-test-renderer/cjs/ReactTestRenderer-prod.js +0.28% 325.64 kB 326.57 kB +0.18% 57.34 kB 57.44 kB
facebook-react-native/react-test-renderer/cjs/ReactTestRenderer-profiling.js +0.27% 347.61 kB 348.55 kB +0.19% 60.42 kB 60.53 kB
react-native/implementations/ReactFabric-prod.fb.js +0.26% 373.90 kB 374.89 kB +0.18% 65.49 kB 65.61 kB
react-native/implementations/ReactFabric-prod.js +0.26% 354.10 kB 355.02 kB +0.16% 61.98 kB 62.09 kB
react-native/implementations/ReactNativeRenderer-prod.fb.js +0.26% 379.51 kB 380.50 kB +0.18% 66.58 kB 66.70 kB
react-native/implementations/ReactNativeRenderer-prod.js +0.25% 362.51 kB 363.43 kB +0.17% 63.37 kB 63.48 kB
react-native/implementations/ReactFabric-profiling.fb.js +0.25% 399.56 kB 400.57 kB +0.17% 69.37 kB 69.49 kB
react-native/implementations/ReactNativeRenderer-profiling.fb.js +0.25% 405.14 kB 406.14 kB +0.18% 70.45 kB 70.57 kB
react-native/implementations/ReactFabric-profiling.js +0.25% 379.50 kB 380.44 kB +0.18% 65.61 kB 65.73 kB
react-native/implementations/ReactNativeRenderer-profiling.js +0.24% 387.91 kB 388.84 kB +0.18% 67.19 kB 67.31 kB
oss-stable-rc/react-art/cjs/react-art.production.js +0.23% 298.49 kB 299.17 kB +0.23% 51.31 kB 51.43 kB
oss-stable-semver/react-art/cjs/react-art.production.js +0.23% 298.49 kB 299.17 kB +0.23% 51.31 kB 51.43 kB
oss-stable/react-art/cjs/react-art.production.js +0.23% 298.55 kB 299.23 kB +0.23% 51.33 kB 51.45 kB
oss-experimental/react-art/cjs/react-art.production.js +0.22% 303.07 kB 303.75 kB +0.25% 52.09 kB 52.22 kB
facebook-www/ReactART-prod.modern.js +0.21% 352.02 kB 352.76 kB +0.19% 59.60 kB 59.72 kB
facebook-www/ReactART-prod.classic.js +0.21% 361.74 kB 362.49 kB +0.17% 61.17 kB 61.27 kB
oss-stable-rc/react-art/cjs/react-art.development.js +0.20% 553.83 kB 554.96 kB +0.17% 89.65 kB 89.81 kB
oss-stable-semver/react-art/cjs/react-art.development.js +0.20% 553.83 kB 554.96 kB +0.17% 89.65 kB 89.81 kB
oss-stable/react-art/cjs/react-art.development.js +0.20% 553.89 kB 555.02 kB +0.17% 89.68 kB 89.83 kB

Generated by 🚫 dangerJS against 404fb64

@sebmarkbage sebmarkbage merged commit 92c0f5f into facebook:main Nov 15, 2024
184 checks passed
github-actions bot pushed a commit that referenced this pull request Nov 15, 2024
…seActionException sentinel (#31554)

This lets us track separately if something was suspended on an Action
using useActionState rather than suspended on Data.

This approach feels quite bloated and it seems like we'd eventually
might want to read more information about the Promise that suspended and
the context it suspended in. As a more general reason for suspending.

The way useActionState works in combination with the prewarming is quite
unfortunate because 1) it renders blocking to update the isPending flag
whether you use it or not 2) it prewarms and suspends the useActionState
3) then it does another third render to get back into the useActionState
position again.

DiffTrain build for [92c0f5f](92c0f5f)
github-actions bot pushed a commit that referenced this pull request Nov 15, 2024
…seActionException sentinel (#31554)

This lets us track separately if something was suspended on an Action
using useActionState rather than suspended on Data.

This approach feels quite bloated and it seems like we'd eventually
might want to read more information about the Promise that suspended and
the context it suspended in. As a more general reason for suspending.

The way useActionState works in combination with the prewarming is quite
unfortunate because 1) it renders blocking to update the isPending flag
whether you use it or not 2) it prewarms and suspends the useActionState
3) then it does another third render to get back into the useActionState
position again.

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

4 participants