react icon indicating copy to clipboard operation
react copied to clipboard

[Devtools] Ensure initial read of `useFormStatus` returns `NotPendingTransition`

Open eps1lon opened this issue 1 year ago • 1 comments

Stack:

  1. https://github.com/facebook/react/pull/28593
  2. https://github.com/facebook/react/pull/28413
  3. https://github.com/facebook/react/pull/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.

eps1lon avatar Apr 03 '24 12:04 eps1lon

Comparing: a7d1240c962d2fdeac3ba31f1fdc12b5be4bbd2e...a3c2f2fc4ed7bd74e322a9ece8e1e89f6cc9417c

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.82 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 500.39 kB 500.37 kB +0.02% 89.78 kB 89.80 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 = 507.52 kB 507.50 kB +0.01% 90.95 kB 90.96 kB
facebook-www/ReactDOM-prod.classic.js = 595.41 kB 595.40 kB +0.02% 105.58 kB 105.60 kB
facebook-www/ReactDOM-prod.modern.js = 571.71 kB 571.70 kB +0.02% 101.78 kB 101.80 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by :no_entry_sign: dangerJS against f117368b9a7abf6433629ce149ed55820c02da2e

react-sizebot avatar Apr 03 '24 12:04 react-sizebot

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 Jul 31, 2024 4:54pm

vercel[bot] avatar Jul 31 '24 16:07 vercel[bot]