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.
| export { useColorScheme, getInitColorSchemeScript, CssVarsProvider, Experimental_CssVarsProvider }; | ||
| export { | ||
| useColorScheme, | ||
| getInitColorSchemeScript, |
There was a problem hiding this comment.
Should we deprecate getInitColorSchemeScript? Or do we expect users to still use it?
There was a problem hiding this comment.
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.
DiegoAndai
left a comment
There was a problem hiding this comment.
LGTM, let's remember to deprecate/remove getInitColorSchemeScript
…nit-color-scheme-component
…nit-color-scheme-component
There was a problem hiding this comment.
@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.
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.
@siriwatknp
How about adding @deprecated jsdoc here?
A warning in IDE is a good developer experience, IMO.
What do you think?
closes #38913