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 <link /> tags get duplicated in <head /> #3169
Comments
@liweinan0423 I had a PR adding the React |
@timneutkens Thanks for your suggestion. I like the |
@liweinan0423 you don't have to, I already did it a while ago. Will pull the fix back in and fix it 👌 |
@timneutkens After I finished my PR I saw your last comment. But could you review and feel free to close it and get in yours :) |
this change is in the |
Relates to #2438 .
If we add the same
<link />
tag multiples in different<Head />
, they are duplicated in the rendered the DOMExpected Behavior
multiple
<link />
tags with exactly the same attributes should be du-duped when rendering HTML<head>
elementse.g.
component1.js
component2.js
Then the rendered HTML should be, where duplicated tags are unique'd
Current Behavior
There will be duplicated tags rendered
Context
I am currently working on a solution with
react-apollo
which allows the data be pre-fetched before a new page is rendered at client side, the example with-apollo-redux only supports prefetching data at server side, therefore, at client side I have to walk through the whole component tree again and do data fetching if one node from the component tree has been wrapped by thegraphql
HOC.Since the component tree contains
<Head />
tags that produces side effects while going through the tree, so duplicated<link />
tags get inserted in the DOM. I was supposed to callHead.rewind()
but it is not allowed at client side.As I know react-helmet will not generate duplicated
<link />
tagsI know we should leave user the liberty of inserting duplicated
<link />
tags if it is desired. But I believe in most cases user doesn't want it. So I am wondering if it would be OK by adding aunique
flag on the tags so the head.js would de-dupe tags withunique
specified.The text was updated successfully, but these errors were encountered: