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

Huge dependency #39

Open
Merri opened this issue Aug 11, 2017 · 2 comments
Open

Huge dependency #39

Merri opened this issue Aug 11, 2017 · 2 comments

Comments

@Merri
Copy link

Merri commented Aug 11, 2017

I swapped from react-document-meta to react-helmet, but while doing that I noticed there appears to be something wrong with the dependencies as when I used react-document-meta my uglified production bundle size was 195 kB while after switching to react-helmet the bundle size dropped down to 65 kB. This change is the only change I made between bundles, so there are certainly some dependency issues that should be resolved. I didn't investigate what causes the issue.

@danieljuhl
Copy link
Contributor

@Merri Thanks for reporting this. I have an idea what is causing this.

May I ask, what other reasons made you switch?

@Merri
Copy link
Author

Merri commented Aug 13, 2017

  1. Title and meta tags were unnecessarily updated after first page render (which match exactly what comes from the server).
  2. It is not possible to get the meta information (with rewind) and then also use the render methods, because once rewind is used the render methods do nothing. Opposite is also impossible: rendering consumes rewind so you get nothing if you call rewind again.
  3. Helmet's syntax makes more sense / is easier to reason about as you don't need to think about custom object formats.

A feature that is missing from Helmet is that you can't easily access the rendered values, you have to use .toComponent() and then loop though elements to find the values you need. To me it seems that the most sensible place to return status codes is via meta http-equiv tags, because you only know if a page is a 404 page after React Router has done it's routing - unless you duplicate all route information before server side render, which I have not wanted to do yet; or in general spend the time thinking how this should go with React Router 4.

Another thing I don't like with Helmet is that it doesn't re-use matching existing meta tags, or check if one of the tags to remove is exactly the same that is going to be added. This means it makes unnecessary DOM manipulation on each route change.

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