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

[Devtools] Ensure initial read of useFormStatus returns NotPendingTransition #28728

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Apr 3, 2024

Stack:

  1. DevTools: Rely on sourcemaps to compute hook name of built-in hooks in newer versions #28593
  2. Devtools: Add support for useFormStatus #28413
  3. [Devtools] Ensure initial read of useFormStatus returns NotPendingTransition #28728 <--- You're here

Summary

We couldn't initialize the HostTransitionContext to NotPendingTransition since that created a dependency cycle. By moving the whole HostTransitionContext into the Fiber config, we no longer have a dependency cycle and can initialize the context to the config specific NotPendingTransition value.

Flow should ensure every Fiber config implements HostTransitionContext properly. It's just a bit annoying since it duplicates config boilerplate.

An incorrect initial value in Devtools would be bad since it probably makes any component not inspectable if you destructure the form status i.e. const {isPending} = useFormStatus() since you'd try to destructure null when we inspect the component.

@react-sizebot
Copy link

react-sizebot commented Apr 3, 2024

Comparing: 734956a...ffc4b05

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 = 168.76 kB 168.74 kB = 52.91 kB 52.91 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 170.57 kB 170.55 kB = 53.44 kB 53.44 kB
facebook-www/ReactDOM-prod.classic.js = 590.83 kB 590.82 kB +0.02% 103.91 kB 103.92 kB
facebook-www/ReactDOM-prod.modern.js = 566.65 kB 566.62 kB = 100.10 kB 100.10 kB
test_utils/ReactAllWarnings.js Deleted 64.44 kB 0.00 kB Deleted 16.10 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
test_utils/ReactAllWarnings.js Deleted 64.44 kB 0.00 kB Deleted 16.10 kB 0.00 kB

Generated by 🚫 dangerJS against ffc4b05

@eps1lon eps1lon force-pushed the formstatus-no-transition-config branch from c4c315f to 592eb8b Compare April 3, 2024 20:03
@eps1lon eps1lon force-pushed the formstatus-no-transition-config branch from 592eb8b to fa7c1dd Compare April 15, 2024 21:14
@eps1lon eps1lon requested a review from acdlite April 15, 2024 21:20
@eps1lon eps1lon force-pushed the formstatus-no-transition-config branch from 3ea5f54 to 5a943b2 Compare April 16, 2024 08:14
@eps1lon eps1lon force-pushed the formstatus-no-transition-config branch from 5a943b2 to ffc4b05 Compare April 16, 2024 08:28
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 React 19
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants