-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[RFC] Improve Next.js integration with a dedicated npm package #34575
Comments
Hello @mnajdova @oliviertassinari, Best regards, |
@garronej It used to be tricky to configure SSR correctly with Material UI v4. The issue was the JSS counter based approach to generate class names, once you have a mismatch it breaks the styles and is really hard to find. I would imagine it's what Theo refers to. Now, I agree that it could be great to abstract this logic. If we do, I think that we should look into how we can make it support different Next.js's versions if they make breaking changes. For example, they have a new experimental layout system vercel/next.js#37136. This could also open the door to more Next.js specific modules, we could abstract the Link and progress bar integration. |
Fair enought, I wasn't aware of the legacy.
👍 |
|
Check out #39712 |
This comment was marked as outdated.
This comment was marked as outdated.
Related to Next.js Link integration: https://twitter.com/benmvp/status/1458609672731070468. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Hi @sgoodrow-zymergen, https://github.com/garronej/tss-react/blob/main/src/next/appDir.tsx We have dark App Router + theme switchin working without issues as demonstrated here: https://next-demo.react-dsfr.fr/mui |
Thanks @garronej, those updates do resolve the issue. Hoping this all gets bundled into a nice package soon! |
@siriwatknp I noticed Yet, this can also be used in other libraries like Joy UI by simply setting the |
Thanks for the suggestion but there will be APIs that are specific to Material UI like |
I'm reopening, I think that until the examples use the new npm package, most people won't use it (until Next.js makes a breaking change and it's less work to just use our package). It will also allow us to guarantee that it works end-to-end.
|
@oliviertassinari #40199 is merged. |
@siriwatknp I think we should update the examples before considering the problem solved: #34575 (comment). |
As I mentioned, #40199 is the PR that update examples to use |
@siriwatknp Oh, got it, awesome 👌. In the future, I think we need a
This isolation of problem scopes seems to work well with what's common for developers. |
Hello everyone 👋🏻
What's the problem? 🤔
It's currently not as straight forward as it could be to setup Material UI in a Next.js project.
Users are encouraged to copy past a bunch of complicated, not type safe code from an example setup.
Proposed solution 🟢
tss-react
exports a utility that abstract away the implementation of emotion's advanced approach for setting up SSR in a Next.js project:Users are expected to set it up this way:
This utility also works well when there's need for multiple emotion caches.
There is nothing specific to
tss-react
in this utility so it could be moved over to the MUI codebase:Resources and benchmarks 🔗
@mantine/next
: https://mantine.dev/guides/next/.@chakra-ui/next-js
: https://chakra-ui.com/getting-started/nextjs-guideThe text was updated successfully, but these errors were encountered: