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

Most upvoted comments

@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 in 5.0.2. It has been fixed in November last year but there is still no release of the 5.x. Until this gets released, I’ve published my own package rl-react-helmet which is just 5.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 https://github.com/janhartmann it’s a somewhat unsatisfying solution, but we got around this (for the time being) by using react-helmet@6.0.0-beta in our package.json.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nfl/react-helmet/issues/441#issuecomment-471965965, or mute the thread https://github.com/notifications/unsubscribe-auth/AADWll_sNiyIqna2nY8QvxbFWBp-BKNAks5vV5JagaJpZM4bPLdi .

@janhartmann it’s a somewhat unsatisfying solution, but we got around this (for the time being) by using react-helmet@6.0.0-beta in our package.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 😃