Duplicate style element in head when using Head API and Theme UI #38249
Labels
status: triage needed
Issue or pull request that need to be triaged and assigned to a reviewer
type: bug
An issue or pull request relating to a bug in Gatsby
Preliminary Checks
Description
When using Head API on a site that uses gatsby-plugin-theme-ui, the
style
elements are duplicated as of Gatsby 5.6 which results in not being able to change the color mode (and likely other side effects). I believe #35841 (comment) is alluding to the same issue.In Gatsby 5.5, there would be 3
css-global
style
elements rendered inhead
, however as of 5.6, there are 6.This issue does not repro if the Head API is not used.
Not sure if this is an issue that needs to be resolved within Gatsby or possibly gatsby-plugin-theme-ui needs to adjust to the behavior change as of Gatsby 5.6 as alluded to here. There is also #37965 which seems similar and shows duplicate
css-global
style
elements so even though it was closed as a different issue, seems as though other plugins might be experiencing similar issue with the Head API and duplicated styles.Gatsby 5.5
Gatsby 5.6+
Reproduction Link
Steps to Reproduce
To reproduce:
npm install
gatsby develop
Without Head - Will Work
linkWith Head With Workaround
linkThe pages work as follows:
With Head - Will Not Work
(aka. Site Root) - Uses the Head APIWithout Head - Will Work
- Does not use the Head APIWith Head With Workaround - Will Work
- Uses the Head API but forces class added to html element when togglingAdditional Information
The repo contains two additional branches:
To use a branch:
git checkout <branchname>
rm -rf ./node_modules/
Expected Result
On main branch:
css-global
style
elements inhead
Actual Result
On main branch:
css-global
style
elements inhead
Environment
Config Flags
N/A
The text was updated successfully, but these errors were encountered: