Repository navigation
Description
react-helmet warns under StrictMode. Every page that sets its title the way ADR 0015 prescribes prints React's UNSAFE_componentWillMount warning in the browser console, once per page load.
Found while porting Learning's progress tab (openedx/frontend-app-learning#2190).
Note
The details below were generated by Claude (Claude Code) and reviewed before posting.
Claude Plan
How it happens today
-
An app sets its document title with
<Helmet>fromreact-helmet: ADR 0015 (status Proposed) says "Every route-level page component in an app is responsible for setting the document title. Apps do this with<Helmet>fromreact-helmet", each app declaring the dependency, and the migration guide's Set the document title on every route-level page gives the code. -
react-helmet6.1.0 buildsHelmetonreact-side-effect:withSideEffect(…)(NullComponent).react-side-effect2.1.2 wraps it in a class component namedSideEffect(NullComponent)that definesUNSAFE_componentWillMount. -
The shell renders the site inside
<StrictMode>. -
Observed on a development site running Learning's frontend-base package (
@openedx/frontend-base2.0.0-alpha.17, React 18.3.1,react-helmet6.1.0), in the browser console on loading a page:Warning: Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details. * Move code with side effects to componentDidMount, and set initial state in the constructor. Please update the following components: SideEffect(NullComponent) -
react-helmet's latest release on npm is 6.1.0, published 2020-06-08.
What the docs say
- React's
<StrictMode>reference, Fixing deprecation warnings enabled by Strict Mode: "React warns if some component anywhere inside a<StrictMode>tree uses one of these deprecated APIs:UNSAFE_class lifecycle methods likeUNSAFE_componentWillMount." - ADR 0015, Rejected alternatives, Standardizing on
react-helmet-async: "react-helmet-asyncis generally recommended overreact-helmetfor React 18+ projects: it avoidsact()warnings, supports streaming SSR, and is actively maintained." and "Standardizing onreact-helmet-asyncacross all apps is a worthwhile follow-up but does not need to block this decision". The ADR does not mention this warning. - The React 19 release post, Support for Document Metadata: "In the past, these elements would need to be inserted manually in an effect, or by libraries like
react-helmet" and "In React 19, we're adding support for rendering document metadata tags in components natively". - The
react-helmet-asyncREADME (3.1.0 on npm, peerreact16.6 to 19): "This package is a fork of React Helmet.", and under React 19, "Starting with version 3.0.0, this package detects the React version at runtime" and "you may not need this package at all — React 19's built-in metadata handling may be sufficient."
How it got here
- The ADR and the migration guide's section came in with docs: ADR and migration guidance for per-page document titles #252 (merged 2026-04-29). The ADR takes the pattern from openedx/frontend-app-authn, which already set titles with
react-helmet(src/login/LoginPage.jsx).
Where it bites
- Learning renders
Helmetinsrc/Main.tsxandsrc/tab-page/LoadedTabPage.tsxof its frontend-base package, which is where the warning above was seen. - The same component is rendered by the route entries of the other converted apps, which were not run for this issue: account, profile, learner dashboard, instructor dashboard, admin console, gradebook, and catalog's home, catalog and course about pages.
Questions
- Does
react-helmet-asyncprint this warning under React 18.3 inStrictMode? Not tested here. - When frontend-base moves to React 19, does React's own
<title>hoisting do what ADR 0015 asks ofHelmet, including one page's title replacing another's across a client-side navigation? Not tested here. - ADR 0015 is still Proposed. Is the library it names part of what is being decided?
- Until the library changes, where does an app author following the migration guide learn that the pattern prints this warning?
Activity