Comments (8)
And awesome work on Mui Joy, it is leaps and bounds easier to work with than material. Global variants is an amazing idea, and overriding the default props within the theme is genius.
from material-ui.
@jamietdavidson It sounds like you'll need to move the exported metadata to a Server Component. This is a Next.js specific issue, so your best bet from here would be to seek help on Stack Overflow. Best of luck! This new paradigm of Server and Client Components can be really tricky to untangle. If you don't have a specific need for the App Router, I might suggest reverting to the Pages Router so you don't have to worry about this stuff at all.
from material-ui.
Hey Jamie 👋 This error message is correct:
Error: Attempted to call getInitColorSchemeScript() from the server but getInitColorSchemeScript 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.
You're calling {getInitColorSchemeScript()}
in layout.tsx
which is a Server Component—you'll need to add the "use client"
directive to that file as well for it to work.
from material-ui.
Hi @samuelsycamore !
Thanks for the reply. I suppose I don't understand the mechanics of Next 14 too well yet. I am then faced with:
You are attempting to export "metadata" from a component marked with "use client", which is disallowed. Either remove the export, or the "use client" directive. Read more: https://nextjs.org/docs/getting-started/react-essentials#the-use-client-directive
Removing the export
prevents my page from having a name when looking at my tabs. What would you recommend I try next?
from material-ui.
@samuelsycamore Will do! Thanks for the timely help :)
from material-ui.
Cheers @jamietdavidson! I think @siriwatknp deserves most of the praise for Joy UI so hopefully he sees this! 😁
from material-ui.
You're calling {getInitColorSchemeScript()} in layout.tsx which is a Server Component—you'll need to add the "use client" directive to that file as well for it to work.
@samuelsycamore getInitColorSchemeScript
shouldn't need to be a client component.
from material-ui.
Duplicate of #39010
from material-ui.
Related Issues (20)
- [Autocomplete] Console error in Next.js App Router project: A props object containing a "key" prop is being spread into JSX HOT 1
- [material-ui][Autocomplete] Due to the multiple option value the input field size getting larger
- [material-ui][Autocomplete] Value not shown after object reaching the condition it should HOT 7
- [docs-infra] Create a custom 404 page for the docs HOT 1
- [material-ui][docs] Missing icon and installation instructions in new landing page template HOT 3
- [joy-ui][Modal] How to put it in the top of the screen (vertical positioning)? HOT 2
- [docs] Demo MultipleSelect crashes
- [material-ui][Autocomplete] Requiring double escape key press to trigger `clearOnEscape` HOT 6
- [material-ui][Autocomplete] Dropdown arrow visible with readOnly prop set to true
- [docs] Deprecated TablePagination SelectProps usage HOT 4
- [material-ui] Next.js compatibility HOT 5
- The "AppsRounded" icon isn't rounded at all (@mui/icons-materia) HOT 3
- [material-ui][SpeedDial] Bug with right/left direction in persistent action tooltips HOT 6
- [system] getColorSchemeSelector() move away from data-color-scheme "attribute value" selector HOT 2
- [system][material-ui] Stabilize CssVarsProvider HOT 4
- [system] Missing dependency on @babel/runtime in Next.js App Router integration HOT 4
- [docs-infra] Style external (target blank) links differently HOT 2
- [docs-infra] Improve type naming on the API pages HOT 2
- [material-ui][Radio Group] Classnames on the API page are seemingly not correct
- NPM hangs when installing material-icons from behind a proxy HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from material-ui.