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

[Fizz] Restore useMemoCache in renderers with support for Client APIs #32067

Merged
merged 1 commit into from
Jan 14, 2025

Conversation

eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Jan 14, 2025

e.g. in react-dom/server: https://codesandbox.io/p/sandbox/usememocache-react-dom-server-nkz4zc?file=%2Fsrc%2Findex.js%3A9%2C1

Broke only recently in #31767. No stable release is affected

Summary

Mainly an oversight since we don't have types based off of feature flags. Now that enableUseMemoCache is shipped, useMemoCache can be non-nullable.

Discovered during integration testing with Next.js where SSR threw with TypeError: dispatcher.useMemoCache is not a function but ultimately recovered due to client-side rendering.

How did you test this change?

Hardened types.

Mainly an oversight since we don't have types based off of feature flags.
Now that `enableUseMemoCache` is shipped, `useMemoCache` can be non-nullable.

Discovered during integration testing with Next.js where SSR threw with `TypeError: dispatcher.useMemoCache is not a function` but ultimately recovered due to client-side rendering.
@react-sizebot
Copy link

Comparing: 453f505...43df636

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 = 514.24 kB 514.24 kB = 91.74 kB 91.73 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 = 556.18 kB 556.18 kB = 98.72 kB 98.72 kB
facebook-www/ReactDOM-prod.classic.js = 595.79 kB 595.79 kB = 104.85 kB 104.85 kB
facebook-www/ReactDOM-prod.modern.js = 586.21 kB 586.21 kB = 103.30 kB 103.30 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable-semver/react-server/cjs/react-server.production.js +0.23% 108.53 kB 108.78 kB +0.40% 19.61 kB 19.69 kB
oss-stable/react-server/cjs/react-server.production.js +0.23% 108.53 kB 108.78 kB +0.40% 19.61 kB 19.69 kB
oss-experimental/react-server/cjs/react-server.production.js +0.20% 122.29 kB 122.53 kB +0.35% 21.47 kB 21.54 kB

Generated by 🚫 dangerJS against e35da38

@eps1lon eps1lon requested a review from poteto January 14, 2025 21:32
@eps1lon eps1lon marked this pull request as ready for review January 14, 2025 21:32
@eps1lon eps1lon changed the title [Fizz] Support useMemoCache in renderers with support for Client APIs [Fizz] Restore useMemoCache in renderers with support for Client APIs Jan 14, 2025
@eps1lon eps1lon merged commit f9f17f6 into facebook:main Jan 14, 2025
188 checks passed
@@ -834,6 +834,7 @@ export const HooksDispatcher: Dispatcher = supportsClientAPIs
useActionState,
useFormState: useActionState,
useHostTransitionStatus,
useMemoCache,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should useCacheRefresh be added here too or not?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

See #32068

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