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

[examples] Use material-nextjs integration package #40199

Merged
merged 10 commits into from
Jan 9, 2024

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp added the examples Relating to /examples label Dec 13, 2023
@mui-bot
Copy link

mui-bot commented Dec 13, 2023

Netlify deploy preview

https://deploy-preview-40199--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 96bbe2d

@samuelsycamore

This comment was marked as resolved.

@@ -1,23 +1,15 @@
import * as React from 'react';
import Head from 'next/head';
import { AppProps } from 'next/app';
import { AppCacheProvider } from '@mui/material-nextjs/v14-pagesRouter';

Choose a reason for hiding this comment

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

Apologies if I'm missing something, but why do we have these versioned paths (v13-* and v14-*)? It looks like v14- just re-exports everything from v13- so wondering if there's a reason we couldn't have @mui/material-nextjs/pagesRouter and @mui/material-nextjs/appRouter?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the question. It's the versioning flexibility for us to maintain. If Nextjs releases a new major (e.g. v15) with breaking changes but Material UI is still in v5, we still have room to create a new integration with Nextjs v15 and people can just bump the material-nextjs version and switch to v15-* APIs.

Copy link
Member Author

Choose a reason for hiding this comment

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

For developers, they just need to use material-nextjs with the same version as Material UI and import the integration from the folder that matches your Nextjs version.

Copy link
Contributor

@DonikaV DonikaV Jan 10, 2024

Choose a reason for hiding this comment

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

Can not find a module or declarations for
import { AppRouterCacheProvider } from '@mui/material-nextjs/v14-appRouter';

That works
import { AppRouterCacheProvider } from '@mui/material-nextjs/build/v14-appRouter';

@siriwatknp
Copy link
Member Author

I'm getting this error when I fire up the material-ui-nextjs example—haven't checked the others:

Error: Attempted to call createTheme() from the server but createTheme is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.

Opps, for got to add use client directive to the theme file, it's been fixed.

@samuelsycamore
Copy link
Member

I'm getting a hydration mismatch in the v4-v5 migration example:

Error: Hydration failed because the initial UI does not match what was rendered on the server.

Warning: Expected server HTML to contain a matching <a> in <a>.

All of the others seem to be working correctly.

@siriwatknp
Copy link
Member Author

I'm getting a hydration mismatch in the v4-v5 migration example:

Error: Hydration failed because the initial UI does not match what was rendered on the server.

Warning: Expected server HTML to contain a matching <a> in <a>.

All of the others seem to be working correctly.

This is not related to the changes but due to Next.js 14. I pushed a fix in 96bbe2d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Relating to /examples nextjs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants