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

Allow wrapping context provider in lazy #26792

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sophiebits
Copy link
Collaborator

Is it OK to export ContextProvider = Context.Provider; from a use client file? If so, behold.

Is it OK to `export ContextProvider = Context.Provider;` from a `use client` file? If so, behold.
@sophiebits sophiebits requested review from sebmarkbage and acdlite May 8, 2023 06:47
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels May 8, 2023
@@ -3509,7 +3518,7 @@ function updateContextProvider(
const providerPropTypes = workInProgress.type.propTypes;

if (providerPropTypes) {
checkPropTypes(providerPropTypes, newProps, 'prop', 'Context.Provider');
checkPropTypes(providerPropTypes, nextProps, 'prop', 'Context.Provider');
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why do we always check these in the reconciler instead of in createElement?

typeof type === 'object' &&
(type.$$typeof === REACT_FORWARD_REF_TYPE ||
// Note: Memo only checks outer props here.
// Inner props are checked in the reconciler.
type.$$typeof === REACT_MEMO_TYPE)

Copy link
Member

Choose a reason for hiding this comment

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

IIRC, there was something subtle about either timing or default prop values? Only vaguely remember this from a comment by @sebmarkbage a while ago.

@react-sizebot
Copy link

Comparing: 559e83a...1fb16d0

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 +0.10% 164.18 kB 164.35 kB +0.04% 51.78 kB 51.80 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js +0.10% 171.57 kB 171.74 kB +0.07% 53.99 kB 54.03 kB
facebook-www/ReactDOM-prod.classic.js +0.07% 570.19 kB 570.59 kB = 100.62 kB 100.59 kB
facebook-www/ReactDOM-prod.modern.js +0.08% 553.93 kB 554.40 kB = 97.80 kB 97.78 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 1fb16d0

@markspolakovs
Copy link
Contributor

If this gets merged #27168 can likely be closed.

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