Closed ericsolberg closed 5 years ago
Could you provide a reproduction?
I can try - this is a fairly large/complex app so getting a minimum reproduction may be hard - but I'll see. Could you comment on what the difference is between building with this plugin, and building without it? Since the app is working without it, I'm not sure what actually changes... That's purely for my education if you don't mind!
@ericsolberg This plugin solves the FOUC issue.
Ah- I was just wondering if there was a way to prevent that. So its def worth figuring it out. I'll see if I can get a minimum repro (and more often than not, that process will lead me to figure out what I did wrong...)
So I've just about got this narrowed down... but I can already see that it seems to be coming from the CardBody component in the Material Kit Pro React component ... still eliminating everything else, but posting this here just in case this is a combination I shouldn't be using ... I've got @material-ui/core v 4.1.3, gatsby-plugin-material-ui v 2.1.2, and Material Kit Pro React v 1.7.0...
The error is being caused by line 39 in cardBodyStyle.jsx in Material Kit Pro React. The selector 'h1, h2, h3' below... I'm not sure if this is valid css-in-js ... will have to look that up.
cardBodyColor: {
borderRadius: '6px',
'&': {
'h1, h2, h3': { // <-- this is the problem... is it valid?
'& small': {
color: 'rgba(' + hexToRgb(whiteColor) + ', 0.8)'
}
}
}
}
OK so sorry to bother you - this bug isn't related to the gatsby-plugin-material-ui plugin. It would certainly be helpful the error generated the source of the offending CSS, or at least the CSS name that it didn't recognize. I'm also not sure why this doesn't show up in development.
I think the 'h1, h2, h3' selector above is just missing the & ... ie '& h1, h2, h3'. As far as I know, it's not a valid sub-selector without that.
@oliviertassinari I'm not sure if you are connected with Creative Tim, but it looks like a small typo in the Material Kit Pro React, cardBodyStyle.jsx line 39. I can go to the CT website and let them know.
Thanks for your help on this.
@ericsolberg It's not valid. I think that you are right, the following should be correct:
"& h1, & h2, & h3": {
Maybe there is a way to get a better failing message, with more helpful debug information when the generated CSS is invalid?
And the plugin did eliminate the FOUC. Excellent! Thank you.
@ericsolberg Did you report the issue to Creative-Tim?
Maybe there is a way to get a better failing message, with more helpful debug information when the generated CSS is invalid?
If we handle this in the plugin, the error message only appears in the build step. Can the error possibly be thrown earlier?
sheets.toString() returned the following ... .jss1 { h1, h2, h3: [object Object]; }
In dev mode, the invalid css was injected without a warning
@oliviertassinari Just did. Thanks.
Since the issue has nothing to do with the plugin, I close it
I'm getting this error (output below) when building my application with this plugin enabled (enabled in gatsby-config.js). If I remove the plugin from gatsby-config.js, the problem goes away. My app still works just fine, so I'm not sure what this plugin actually does. But you can see in the error stack trace the error is originating in this plugin.
I'm using the latest versions of everything (I've updated all my plugins). I'm not sure where I'd even look to resolve this error further. I also don't get the error in development mode.