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

Multiple <Helmet> tags will break (only one will render) #683

Open
matthew-dean opened this issue May 31, 2022 · 3 comments
Open

Multiple <Helmet> tags will break (only one will render) #683

matthew-dean opened this issue May 31, 2022 · 3 comments

Comments

@matthew-dean
Copy link

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
A component has a <Helmet> component tag inside it. That component is rendered along-side another <Helmet> tag. However, the contents of only one <Helmet> tag will render.

If the current behavior is a bug,
please provide the steps to reproduce and if
possible a minimal demo of the problem.
Your bug will get fixed much faster if we can run your
code and it doesn't have dependencies other than React and react-helmet.
Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or
CodeSandbox (https://codesandbox.io/s/new) example below:

https://codesandbox.io/s/sparkling-dust-qc0zgn?file=/src/index.js

What is the expected behavior?
The contents of both <Helmet> tags will render

Which versions of React and react-helmet, and which browser / OS are affected by this issue?
Did this work in previous versions of React and/or react-helmet?

React 16.14.0 / React-Helmet 6.1.0

@matthew-dean
Copy link
Author

Additional context -- I've checked this with React 17 and the issue persists. React 18 didn't seem to have the issue, but we're not ready to upgrade to React 18.

@matthew-dean
Copy link
Author

I think this may be a bug related to this feature:

Nested or latter components will override duplicate changes

In this case, these are not duplicates but are completely unique tags. But they are obliterated by the later <Helmet> call.

@derzierau
Copy link

+1 same for us. In our case our site uses react-helmet and we have a web component running inside of it using also react-helmet. It initially renders the main site helmet tags and deletes them when the web component is rendered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants