VulcanJS / Vulcan

🌋 A toolkit to quickly build apps with React, GraphQL & Meteor
http://vulcanjs.org
MIT License
7.98k stars 1.89k forks source link

Double Head Tags #2443

Closed andreyunugro closed 4 years ago

andreyunugro commented 4 years ago

Hi,

I am playing around with Vulcan and Vulcan Starter and I found that Vulcan Starter generate double head tags. image

The head tags not related to browser, I tried firefox and chromium. I use clean Meteor, clean Vulcan (devel), and clean Vulcan Starter (devel), because I want to be able to use latest Vulcan version.

Please help. Thanks.

eric-burel commented 4 years ago

I wonder if it happens only when there are SSR errors. Did you have some Did not expect server HTML to contain a <div> in <main> error in the console or similar?

yannick-mayeur commented 4 years ago

I get the double head tags in the Vulcan Starter without having error in the console besides a warning about ComponentWillMount.

eric-burel commented 4 years ago

We will need to replace react-helmet by react-helmet-async more broadly (https://github.com/staylor/react-helmet-async), maybe it would solve this issue. @yannick-mayeur it's an interesting update and it could solve this issue, however it's rather difficult

yannick-mayeur commented 4 years ago

The double heads seem to come from the _boilerplate_generator in the Vulcan Starter there is one <head> hard coded and one that seems to come from the dynamicHead.

yannick-mayeur commented 4 years ago

Just removing the hard coded one would solve the issue, but I don't know if the dynamicHead always contains the head tag.

eric-burel commented 4 years ago

Normally yes but you can checkout the official documentation and explore the code to get a better understanding. If it seems to solve the issue you can open a PR anyway and we will check that more thoroughly.

yannick-mayeur commented 4 years ago

I have done a PR on the Vulcan Starter repo: https://github.com/VulcanJS/Vulcan-Starter/pull/141

The _boilerplate_generator also exists in this repo, but I am not sure if the behavior is similar to the one from the Vulcan-Starter.

eric-burel commented 4 years ago

Yes it's the same you can PR this one too I think. Vulcan is technically an app, though we barely actually run it. If you do "npm run start" on Vulcan you may notice the same issue. It would be better not to duplicate the code of course but _boilerplate_generator_ is totally internal to Meteor so we can't.

eric-burel commented 4 years ago

It would probably need testing both with SSR enabled (default) and disabled.

eric-burel commented 4 years ago

Fixed by #2485

andreyunugro commented 4 years ago

Thank you very much!