-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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 InitColorSchemeScript
for Next.js App Router
#42247
Add InitColorSchemeScript
for Next.js App Router
#42247
Conversation
InitColorSchemeScript
for Next.js App RouterInitColorSchemeScript
for Next.js App Router
Netlify deploy preview
@material-ui/core: parsed: +Infinity% , gzip: +Infinity% Bundle size reportDetails of bundle changes (Toolpad) |
InitColorSchemeScript
for Next.js App RouterInitColorSchemeScript
for Next.js App Router
suppressHydrationWarning | ||
nonce={typeof window === 'undefined' ? nonce : ''} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export { useColorScheme, getInitColorSchemeScript, CssVarsProvider, Experimental_CssVarsProvider }; | ||
export { | ||
useColorScheme, | ||
getInitColorSchemeScript, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we deprecate getInitColorSchemeScript
? Or do we expect users to still use it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I think it can be removed but I'd do it in a separate PR and add note to the migration doc in the same PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let's remember to deprecate/remove getInitColorSchemeScript
…nit-color-scheme-component
…nit-color-scheme-component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siriwatknp This change blocks the monorepo upgrade for MUI X because we're using @mui/material@5
:
https://app.netlify.com/sites/material-ui-x/deploys/66851d4bfe59880008524540#L240
Do you think we can keep using getInitColorSchemeScript
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, I found a PR that should address this and left a comment there 🙂
#42829 (comment)
}, | ||
}); | ||
|
||
let warnedInitScriptOnce = false; | ||
|
||
const getInitColorSchemeScript: typeof deprecatedGetInitColorSchemeScript = (params) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siriwatknp
How about adding @deprecated
jsdoc here?
A warning in IDE is a good developer experience, IMO.
What do you think?
closes #38913