Uncaught RangeError: Maximum call stack size exceeded

Hey,
HelmetWrapper uses deepEqual to compare props and of course, there are react children components with endless amount of nested objects.
This seems like a dangerous way to check props equality. Could we turn HelmetWrapper into PureComponent?
Same here. Is there a solution to this?
Yeh same.
The work around for us was to not use react children to pass in <meta> <title> tags, and use the props way:
<Helmet
title={pageTitle}
meta={[
{
name: 'description',
content: pageDescription,
},
]}
/>
Just ran into this issue as well. Only saw it happening for Safari and Chrome browsers.
What is the reasoning behind the deep equality check? Per the React docs...
We do not recommend doing deep equality checks or using JSON.stringify() in shouldComponentUpdate(). It is very inefficient and will harm performance.
I believe you can also work around this by applying a unique key prop to the <Helmet> component, for example <Helmet key={window.location.href}>. Perhaps a bit cleaner than using the props method above.
@jaredLunde not sure how that could speed up deepEqual in shouldComponentUpdate
https://github.com/nfl/react-helmet/blob/c102586229549650ddb0f9615a42d351a2c7241b/src/Helmet.js#L93
@dmitriykharchenko Sorry, that was a reference to the Uncaught RangeError: Maximum call stack size exceeded error and presumably https://github.com/nfl/react-helmet/issues/373#issuecomment-392650715 - not anything perf related.
@jaredLunde this error happens because ReactHelmet compares props with deepEqual and when there are children in props it iterate over children as well and since those children are React components (not a plain objects) it simply overflows the stack. The workaround is to avoid providing any children to <Helmet/> component, but anyway, deepEqual is still bad.
So, I don't see any reason why <Helmet/> needs a key prop
@dmitriykharchenko Gotcha! Well in that case, key solves the problem because deepEqual never gets called in shouldComponentUpdate as the component re-mounts instead of updating. Hence, no stack overflow. Was very useful in my case.
Hm, interesting. Do you have a link to read more about re-mounts of keyed elements?
https://reactjs.org/docs/reconciliation.html#keys
Essentially, when the key changes it tells the reconciliation algorithm that the element in the new tree is different from the element in the old tree. If the new key wasn't in the children in old tree, a new component is mounted. If the new key was in the children in the old tree the element will be re-used.
Aha, you mean that you have to update that key on every render. Yep, that seems faster than deepEqual, but still not quite clean as fix deepEqual or avoid children.
Well, you only have to update the key when the underlying children change. In my case that happens when that particular view URL changes, but you can use any string representation. Maybe someone has a react-router match.params change which updates the title or meta information - that'd be a good spot to use key IMO. Anything where state affects the children.
It might not work in some cases. Either way I think we're all in agreement that deepEqual is a bad practice in sCU.
This is a really bad bug - as the props way is not even the documented recommended way to pass metadata to helmet, and there is no other workaround.
Just replace it by https://github.com/FormidableLabs/react-fast-compare
Why this is still not adressed?
keytrick doesn't help in all cases- Library still crashes in 5.2.0
This bug is devastating. Had to switch to react-helmet-async which doesn't have this problem 😢
https://github.com/nfl/react-helmet/pull/402 was merged into master. I would like to get the roll-up PR merged and we can release a beta version for feedback.