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

Add stub for experimental_useFormStatus #26719

Merged
merged 1 commit into from
Apr 25, 2023

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Apr 24, 2023

This wires up, but does not yet implement, an experimental hook called useFormStatus. The hook is imported from React DOM, not React, because it represents DOM-specific state — its return type includes FormData as one of its fields. Other renderers that implement similar methods would use their own renderer-specific types.

The API is prefixed and only available in the experimental channel.

It can only be used from client (browser, SSR) components, not Server Components.

This wires up, but does not yet implement, an experimental hook called
useFormStatus. The hook is imported from React DOM, not React, because
it represents DOM-specific state — its return type includes FormData as
one of its fields. Other renderers that implement similar methods would
use their own renderer-specific types.

The API is prefixed and only available in the experimental channel.

It can only be used from client (browser, SSR) components, not
Server Components.
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Apr 24, 2023
@react-sizebot
Copy link

Comparing: 5e5342b...663e13a

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.min.js = 163.92 kB 163.92 kB = 51.68 kB 51.68 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js +0.06% 168.70 kB 168.80 kB +0.08% 53.04 kB 53.09 kB
facebook-www/ReactDOM-prod.classic.js +0.05% 570.27 kB 570.52 kB +0.09% 100.93 kB 101.02 kB
facebook-www/ReactDOM-prod.modern.js +0.05% 554.00 kB 554.26 kB +0.09% 98.26 kB 98.34 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 663e13a

@@ -31,6 +31,7 @@ export {
unstable_createEventHandle,
unstable_renderSubtreeIntoContainer,
unstable_runWithPriority, // DO NOT USE: Temporarily exposed to migrate off of Scheduler.runWithPriority.
useFormStatus as experimental_useFormStatus,
Copy link
Collaborator

@sebmarkbage sebmarkbage Apr 24, 2023

Choose a reason for hiding this comment

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

Just noticing that the form flag is on in www but not the async transitions one so it's kind of a useless combination for this export.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I intentionally kept the async one off because it affects error handling behavior even in regular, sync useTransition. Should we turn enableFormActions off too?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yea, let's do that for now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If we turn them on we have to also update this to get the right external runtime from experimental or make an fb build.

https://github.com/facebook/react/blob/main/.github/workflows/commit_artifacts.yml#L137-L138

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok I opened a separate PR where we can discuss: #26721

@acdlite acdlite merged commit 919620b into facebook:main Apr 25, 2023
acdlite added a commit to acdlite/react that referenced this pull request May 7, 2023
This was an oversight when I set up the hook in facebook#26719
acdlite added a commit that referenced this pull request May 7, 2023
This was an oversight when I set up the hook in #26719.
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
This wires up, but does not yet implement, an experimental hook called
useFormStatus. The hook is imported from React DOM, not React, because
it represents DOM-specific state — its return type includes FormData as
one of its fields. Other renderers that implement similar methods would
use their own renderer-specific types.

The API is prefixed and only available in the experimental channel.

It can only be used from client (browser, SSR) components, not Server
Components.
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
This was an oversight when I set up the hook in facebook#26719.
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
This wires up, but does not yet implement, an experimental hook called
useFormStatus. The hook is imported from React DOM, not React, because
it represents DOM-specific state — its return type includes FormData as
one of its fields. Other renderers that implement similar methods would
use their own renderer-specific types.

The API is prefixed and only available in the experimental channel.

It can only be used from client (browser, SSR) components, not Server
Components.

DiffTrain build for commit 919620b.
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
This was an oversight when I set up the hook in #26719.

DiffTrain build for commit 16d053d.
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