Skip to content

Conversation

@siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented May 15, 2024

closes #38913


@siriwatknp siriwatknp changed the title [POC] add InitColorSchemeScript for Next.js App Router [POC] Add InitColorSchemeScript for Next.js App Router May 15, 2024
@mui-bot
Copy link

mui-bot commented May 15, 2024

Netlify deploy preview

@material-ui/core: parsed: +Infinity% , gzip: +Infinity%
@mui/joy: parsed: +Infinity% , gzip: +Infinity%
@material-ui/lab: parsed: +Infinity% , gzip: +Infinity%
@mui/joy/Autocomplete: parsed: +Infinity% , gzip: +Infinity%
@material-ui/unstyled: parsed: +Infinity% , gzip: +Infinity%
Autocomplete: parsed: +Infinity% , gzip: +Infinity%
TextField: parsed: +Infinity% , gzip: +Infinity%
@mui/joy/Select: parsed: +Infinity% , gzip: +Infinity%
SpeedDialAction: parsed: +Infinity% , gzip: +Infinity%
@mui/joy/Menu: parsed: +Infinity% , gzip: +Infinity%
Tooltip: parsed: +Infinity% , gzip: +Infinity%
@mui/joy/Tooltip: parsed: +Infinity% , gzip: +Infinity%
SwipeableDrawer: parsed: +Infinity% , gzip: +Infinity%
@mui/joy/Drawer: parsed: +Infinity% , gzip: +Infinity%
TabList: parsed: +Infinity% , gzip: +Infinity%
@mui/joy/Snackbar: parsed: +Infinity% , gzip: +Infinity%
SpeedDial: parsed: +Infinity% , gzip: +Infinity%
Pagination: parsed: +Infinity% , gzip: +Infinity%
@mui/joy/MenuButton: parsed: +Infinity% , gzip: +Infinity%
@mui/joy/ChipDelete: parsed: +Infinity% , gzip: +Infinity%
and 266 more changes

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against 0e38328

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label May 27, 2024
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Jun 10, 2024
@siriwatknp siriwatknp changed the title [POC] Add InitColorSchemeScript for Next.js App Router Add InitColorSchemeScript for Next.js App Router Jun 10, 2024
@siriwatknp siriwatknp marked this pull request as ready for review June 10, 2024 09:57
@siriwatknp siriwatknp added package: material-ui type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. nextjs scope: system The system, the design tokens / styling foundations used across components. eg. @mui/system with MUI and removed proof of concept labels Jun 10, 2024
@zannager zannager requested a review from brijeshb42 June 10, 2024 11:38
Comment on lines +61 to +62
suppressHydrationWarning
nonce={typeof window === 'undefined' ? nonce : ''}
Copy link
Member Author

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,
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

@DiegoAndai DiegoAndai left a 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

Copy link
Member

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?

Copy link
Member

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) => {
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nextjs scope: system The system, the design tokens / styling foundations used across components. eg. @mui/system with MUI type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[system] Add nonce to CssVarsProvider and getInitColorSchemeScript() for CSP

4 participants