You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
jooy2
changed the title
[pigment-css] Externally defined classname styles not loading correctly when using Next.js?
[pigment-css] Externally defined classname styles not loading correctly when using Next.js
Jan 5, 2025
This is something that we are fixing in the v1 version slated for release at the end of quarter.
This is an issue with specificity which cannot be fixed right away. Keeping this open for tracking.
I'll also keep this issue open instead of closing it.
Regards,
jooy2
changed the title
[pigment-css] Externally defined classname styles not loading correctly when using Next.js
Externally defined classname styles not loading correctly when using Next.js
Jan 16, 2025
Steps to reproduce
There are the following repositories where you can try to reproduce this issue:
https://github.com/jooy2/nextart
npm i
npm run dev
First, notice that the button is black on the main page (
/
). Refresh (F5) and the button should still be black.Then, without refreshing, click the button to go to the second page. The second page has the same style applied, so the button will be black.
However, if you do a refresh on the second page with this state, the button will be unstyled and blue.
Buttons should appear black in all situations, such as refreshing and switching routing.
Current behavior
The button doesn't apply the customized style in certain situations.
Expected behavior
Buttons should appear black in all situations, such as refreshing and switching routing.
Pigment-css also need to be able to use the styles you define in the external file.
Context
Buttons with external styles in a client component do not seem to be applied when the page is loaded.
However, as an exception, if the styles applied to that component are defined in the same file, the problem is not reproduced.
In my current implementation, this is the situation with the client component code:
The
cssBlackButton
was defined in an external file:I haven't reviewed everything, but this seems to happen most notably with the Button component (ButtonBase).
Maybe I missed some setting or migration item in pigment-css or material-ui. Or maybe this is what was intended, I don't know.
I would like to know if this is a valid issue and if there is a workaround at this time. Thank you for your help.
Your environment
npx @mui/envinfo
Search keywords: pigment-css,nextjs,client-component,external-file
The text was updated successfully, but these errors were encountered: