Skip to content
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

When using gatsby's Head API, the Chakra UI theme is applied as the default theme #37965

Closed
2 tasks done
Ryong-E opened this issue Apr 20, 2023 · 1 comment
Closed
2 tasks done
Labels
type: bug An issue or pull request relating to a bug in Gatsby

Comments

@Ryong-E
Copy link

Ryong-E commented Apr 20, 2023

Preliminary Checks

Description

Before using gatsby's Head API, the theme you defined was applied as normal, but after applying the Head API, it is applied as the default theme

Screen Shot 2023-04-20 at 17 47 59

this i defined theme

Screen Shot 2023-04-20 at 17 44 26

i used chakra UI plugin

Screen Shot 2023-04-20 at 17 45 33

This is the Provider component with the theme I defined for the chakraProvider

Screen Shot 2023-04-20 at 17 45 50

I'm applying the above provider as a wrapPageElement to gatsby-ssr, gatsby-browser

I'm creating a template and generating pages through gatsby-node.
When I don't apply the head API to the template, the theme I defined is applied as normal.
However, when I apply the head API and run a test, the default theme is applied

If we say that the top page does not use the head API and the bottom page applies the head API, then the

Screen Shot 2023-04-18 at 22 20 56

This is what it looks like inside the head tag on the top page

Screen Shot 2023-04-18 at 22 21 06

The following picture shows the head tag when we jump from the top page to the page where we applied the head API.
You can see that an additional style tag has been created, unlike before

The solution I found was to use the
is to set it to body via cssVarsRoot, a property of the ChakraProvider.

I wonder if I'm doing something wrong, or if this is the intended behaviour of the Head API?

Reproduction Link

Cannot be created with the latest version of Gatsby

Steps to Reproduce

I can't use codesendbox because I'm using the latest version of gatsby

Let's keep it simple

For custom theme, please change the colour to gray.800

Gatsby-ssr, Gatsby-browser with a custom themed ChakraProvider using the
wrapPageElement to a ChakraProvider with a custom theme.

Expected Result

The SEO you set will be applied and the
the theme you defined should also be applied

Actual Result

The SEO you set will be applied
When I applied the Head API, I got the colour grey.800 and the
You can see that the colour of gray.800 is different when the API is not applied

Environment

System OS: Mac OS
gatsby: 5.7.0
chakraUI/: 2.5.1
chakra-ui/gatsby-plugin": "^3.1.1",
emotion: 11.10.6
react: 18.2.0
react-dom: 18.2.0

Config Flags

Not used

@Ryong-E Ryong-E added the type: bug An issue or pull request relating to a bug in Gatsby label Apr 20, 2023
@gatsbot gatsbot bot added type: question or discussion Issue discussing or asking a question about Gatsby status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Apr 20, 2023
@LekoArts LekoArts removed type: question or discussion Issue discussing or asking a question about Gatsby status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Apr 20, 2023
@LekoArts
Copy link
Contributor

Hi!

This is specific to your usage of Chakra UI, not Gatsby it seems. I already answered you in chakra-ui/chakra-ui#7589 what you need to do.

As you also can't reproduce this I'm closing this in favor of chakra-ui/chakra-ui#7589

@LekoArts LekoArts closed this as not planned Won't fix, can't repro, duplicate, stale Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

2 participants