Skip to content

Upgrade react-helmet to v6 to fix componentWillMount warning - #4326

Open
samchinmaya wants to merge 1 commit into
processing:developfrom
samchinmaya:fix/3833-react-helmet-warning
Open

samchinmaya wants to merge 1 commit into
processing:developfrom
samchinmaya:fix/3833-react-helmet-warning

Conversation

@samchinmaya

Copy link
Copy Markdown

Issue:

Fixes #3833

The componentWillMount has been renamed warning for SideEffect(NullComponent) still appears on develop (see my comment on the issue). It isn't from the editor component: it comes from react-side-effect@1.1.5, a dependency of react-helmet@5.2.1, which we use in 19 components to set page titles.

Demo:

No UI change. Page titles are set the same way as before, checked in the browser on the IDE, About, Login, Signup, Reset Password, Privacy Policy, Terms of Use, full view, saved sketch, sketch list and collection list pages, plus client-side navigation (About → Login updates the title).

Warning count in npm run test (client project):

componentWillMount warnings
Before 4 (index.integration.test.jsx, AddToCollectionSketchList.unit.test.jsx, Preferences.unit.test.jsx, SketchList.unit.test.jsx)
After 0

Changes:

  • Bump react-helmet from ^5.1.3 to ^6.1.0. v6 depends on react-side-effect@2, which uses UNSAFE_componentWillMount instead.
  • No code changes needed: v6 still exports Helmet as both a default export (used in FullView.jsx, Legal.tsx) and a named export (used everywhere else).
  • Lockfile changes are limited to react-helmet, react-side-effect, react-fast-compare, and removing exenv (no longer needed by react-side-effect@2).

Longer term, react-helmet-async is the maintained alternative, but it needs a HelmetProvider wrapper around the app and the test render helper, so I kept this PR to the minimal fix.

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test) — all client tests pass; in my local Docker setup server/models/__test__/user.test.ts fails on develop too, because mongodb-memory-server can't download MongoDB 7.0.0 for Debian 12 (unrelated to this change)
  • has no typecheck errors (npm run typecheck)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number, i.e. Fixes #123
  • meets the standards outlined in the accessibility guidelines

react-helmet 5 depends on react-side-effect 1, which uses the deprecated
componentWillMount lifecycle and logs a React warning for
SideEffect(NullComponent). react-helmet 6 uses react-side-effect 2, which
renames it to UNSAFE_componentWillMount. v6 still exports Helmet as both
a default and a named export, so no code changes are needed.

Fixes processing#3833

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

Unwanted warning componentWillMount has been renamed, and is not recommended for use.

1 participant