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
Duplicated head tag after page load #36309
Comments
Please add a complete reproduction repository. |
ok, will try to create a reduced repo. Is it possible we are seeing the same on nextjs.org? i see some tags duplicated, chartset and viewport |
We are experiencing the same behaviour. On the initial page load there is one og:title tag, but when we navigate to another page a og:title tag is added. When we then change pages again, only one is updated, the other tag keeps the old values. |
We noticed the same behaviour. I am trying to get a simplifed repo to reproduce, but not straight forward it seems, not just related to the document.tsx i guess. But i can see a duplicated tag on nextjs.org page, with charset and viewport, not sure if the same root cause. |
This issue has been automatically closed because it received no activity for a month and had no reproduction to investigate. If you think this was closed by accident, please leave a comment. If you are running into a similar issue, please open a new issue with a reproduction. Thank you. |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
yarn dev
Describe the Bug
We define some common head elements on document.tsx file, for instance...
<Head> <script async src={
https://www.googletagmanager.com/gtag/js?id=someId/>
<script
dangerouslySetInnerHTML...`
Then some other tags such as og:title as part of a component using next/head.
We noticed that after document reached a certain size-we added some additional scripts which were +200 lines long -, some tags, such as og:title, not defined on document tsx appear duplicated. Once we navigate to a new page, where the component updates, only one of them is updating. This happens for tags where we use key atribute as well, but not for all tags.
Expected Behavior
Only one og:title meta tag is created.
I wonder this is restricted to this only. Not sure if this is intended but I can see other duplicated tags added by the framework, such as charset and viewport.
To Reproduce
There is no clear pattern to reproduce unfortunately. On the local environment, a large document tsx creates more head element duplicates. We can see the duplicate viewport as well on nextjs.org site. Page loads with 1 viewport tag, but after load another one is added. For a large document tsx, I can also see other tags being duplicated, and only one of them being updated after changing page.
The text was updated successfully, but these errors were encountered: