`react-helmet` warns under `StrictMode`

Abierto
#350 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
react, typescript
Área
frontend

Línea de trabajo

Start with ADR 0015 and the migration guide’s page title section, then inspect the shell’s StrictMode wrapper and the Helmet usage described in the issue. Determine how the warning should be handled in the framework and whether the ADR’s proposed library choice is in scope. Done means the chosen approach addresses the React 18 StrictMode warning and leaves app authors with clear guidance.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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> from react-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> from react-helmet", each app declaring the dependency, and the migration guide's Set the document title on every route-level page gives the code.

  • react-helmet 6.1.0 builds Helmet on react-side-effect: withSideEffect(…)(NullComponent). react-side-effect 2.1.2 wraps it in a class component named SideEffect(NullComponent) that defines UNSAFE_componentWillMount.

  • The shell renders the site inside <StrictMode>.

  • Observed on a development site running Learning's frontend-base package (@openedx/frontend-base 2.0.0-alpha.17, React 18.3.1, react-helmet 6.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 like UNSAFE_componentWillMount."
  • ADR 0015, Rejected alternatives, Standardizing on react-helmet-async: "react-helmet-async is generally recommended over react-helmet for React 18+ projects: it avoids act() warnings, supports streaming SSR, and is actively maintained." and "Standardizing on react-helmet-async across 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-async README (3.1.0 on npm, peer react 16.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 #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

Questions

  • Does react-helmet-async print this warning under React 18.3 in StrictMode? Not tested here.
  • When frontend-base moves to React 19, does React's own <title> hoisting do what ADR 0015 asks of Helmet, 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?
Lenguaje dominante
TypeScript
Estrellas
4
Forks
13
Merge medio
3 d 5 h
PR fusionados (30 d)
4

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de openedx/frontend-base

Todos los issues de openedx/frontend-base

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.