-
Notifications
You must be signed in to change notification settings - Fork 676
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
theme.styles are not applied in Gatsby site #1345
Comments
Thanks for the issue, @454de6e! This is certainly something we should work on, but in the meantime could you try the following?
|
@hasparus Adding above resolutions does not fix the issue. Do I need to pin the version in the dependencies as well? And can you give me an idea of what you suspect is happening? Maybe that would help me trouble shoot further. And I have been running into this Theme UI problem already some time ago, see here: UNStats/gatsby-themes#375. In this instance the issue was introduced when I tried bumping What ever happens, it basically breaks the core of |
@454de6e - I tried your example and a couple things come to attention
|
Oh, and I have it frozen at 2.0.0-next.7 if that makes a difference
in https://github.com/maiertech/gatsby-themes/blob/theme-ui-styles-broken/package.json |
Thank you @atanasster for looking into this! You are absolutely right, I goofed up Just to clarify, Theme UI styling works fine outside the MDX transformation. When I use Theme UI components, including To fix the MDX transformation I settled on
in line with what you suggested. This fixes it, but I still don't fully understand why. I see now in the devtools that the inner To understand this would be important, because the underlying Gatsby themes will only work correctly when the |
@454de6e - great to hear its fixed now for you. You are correct, its an issue with context versions. I will close this, but please open a new issue if you have any further troubles with theme-ui :) |
@454de6e React Contexts seem to be compared "by reference". Multiple versions of a package exposing context provider in your deps result in context provider not connecting to context consumer. @atanasster @lachlanjc Should we change our MDX dep to a peer dep? |
@hasparus - I havent researched in-depth but this seems a one-off issue with mdxjs (they had pinned versions of some packages causing multiple versions to be loaded) and afaics they have "fixed" it as of june this year: mdx-js/mdx#865 For a peer dep, I am not really supportive at this point - however we should upgrade the mdxjs/react dependencies to theme-ui/packages/mdx/package.json Line 17 in 8616794
|
@atanasster @hasparus @lachlanjc After giving this some more thought, I think bumping above dependency will not fix this for good. The root cause of the issue was me using When using But I also see your point that you want |
@454de6e thanks a lot for the feedback. You raise some very valid points, but just to clarify - the issue is with earlier versions of
Here is a branch from earlier this year: This is no longer the case with the latest mdxjs/react` 1.6.22, where react is a peerDependency: To cut it short - I think if we install a newer version of However, your point of installing Regardless, thank you very much for taking the time to think about this and come up with a very viable suggestion. |
Describe the bug
I have a Gatsby site that does not apply any styles from
theme.styles
during MDX transformations withtheme-ui
andgatsby-plugin-theme-ui
both at v0.3.4.To Reproduce
theme.styles
styles them.Expected behavior
Both links should not be styled with browser defaults but with primary color.
Additional context
This looks like #1148 posted by @cwgw.
Running
yarn list --pattern mdx
yields this:Not sure why
@theme-ui/mdx@0.3.4
wants@mdx-js/react@1.6.21
. I addedand that did not fix the issue (after a Gatsby clean).
I am completely lost here.
The text was updated successfully, but these errors were encountered: