react-helmet: deep-equal crashes on newer React?
I’ve experienced some call-too-deep errors, and I think somehow React is introducing circular references and then deep-equal follows them.
I worked around this like so:
import {isEqual} from 'lodash'
// Helmet uses deep-equal and sometimes crashes on circular objects
Helmet.prototype.shouldComponentUpdate = function(nextProps) {
return !isEqual(this.props, nextProps)
}
It seems to work - lodash has circular reference protection.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 23
- Comments: 22 (4 by maintainers)
Commits related to this issue
- Replace deepEqual with isEqual (#441) (cherry picked from commit 1803f678b9d38b5ae91961ea13ea1c7fa7c9afe8) — committed to Volune/react-helmet by Volune 6 years ago
- Replace deepEqual with isEqual (#441) (cherry picked from commit 1803f678b9d38b5ae91961ea13ea1c7fa7c9afe8) — committed to Volune/react-helmet by Volune 6 years ago
- Fix compatibility with React 16.8 (#444) * Replace deepEqual with isEqual (#441) (cherry picked from commit 1803f678b9d38b5ae91961ea13ea1c7fa7c9afe8) * docs: 5.2.1 release * Update travis.ym... — committed to nfl/react-helmet by Volune 5 years ago
- Update react-helmet to 5.2.1 5.2.0 had a bug where it could crash the app (Internal error: too much recursion). More info https://github.com/nfl/react-helmet/issues/441 — committed to City-of-Helsinki/varaamo by jimppa 5 years ago
- Fix deep-equal crashes in 03-saga Update 03-saga/package.json. For fix deep-equal crashes.(https://github.com/nfl/react-helmet/issues/441) — committed to track8/ReactBeginnersBook-2.0 by track8 5 years ago
@tmbtech I can see the fix has now been pushed to a branch - great! Is 5.2.1 going to be published to npm soon?
@cwelch5 - any chance you can give this issue some love? It looks like a quick release of this package to NPM would help lots of us out 🙏
I can confirm it’s unusable with React
16.8.x, it crashes after a few renders This fix is in master but not in5.0.2. It has been fixed in November last year but there is still no release of the5.x. Until this gets released, I’ve published my own packagerl-react-helmetwhich is just5.0.2+ this patch.Sorry I don’t have publishing right. @miblanchard @cwelch5 do you have any time to publish to NPM?
I don’t normally do this, but in this case of a seemingly abandoned library I’d like to point out that the fork react-helmet-async is only a small change to implement, it has the fix, it is updated, and it is better for SSR.
Thanks to the NFL in any case for the great library!
On Tue., Mar. 12, 2019, 12:41 p.m. Mike Bifulco notifications@github.com wrote:
@janhartmann it’s a somewhat unsatisfying solution, but we got around this (for the time being) by using
react-helmet@6.0.0-betain ourpackage.json.@miblanchard was so kind and published an updated version.
Closing, thank you all.
I have to say though, it would be nice to keep v5 working, specially if it’s a simple fix (publish that commit). Thanks again. Edit: And also because v6 is still beta.
Have you tried to use v.6-beta? More info here - https://github.com/nfl/react-helmet/pull/421#issuecomment-450449810
I got the same error on Firefox (InternalError: too much recursion) with React 16.8.3 and Helmet 5.2.0.
Thanks for your code @wmertens, I’ll test it 😃