A `<noscript>` with an element inside fails hydration and replaces the server DOM
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- next.js, react, typescript
- Área
- frontend
Línea de trabajo
Start with the reproduction in app/noscript/page.jsx and compare production behavior with and without withRedact using the reported Next.js and React versions. Check related issue #43, whose unmerged change may cover this case and conflicts with main. Done means the noscript example hydrates without a page error and keeps the server-rendered DOM.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Version: @tanstack/redact 0.2.6 via withRedact, Next.js 16.4.3 (App Router, Turbopack, production), react/react-dom 19.3.1, Chromium.
What happens
A <noscript> that contains an element, such as Google Tag Manager's <noscript><iframe …></noscript>, makes Redact report Hydration mismatch. and replace the server-rendered DOM. React 19.3.1 hydrates the same page with no errors and keeps the server nodes.
Repro
// app/noscript/page.jsx
export default function Page() {
return (
<main>
<p id="content">Page content</p>
<noscript>
<iframe src="about:blank" height="0" width="0" style={{ display: 'none' }} title="No script" />
</noscript>
</main>
)
}
next build && next start, then load /noscript, with and without withRedact:
| React 19.3.1 | Redact 0.2.6 | |
|---|---|---|
Server <p id="content"> kept |
yes | no, replaced |
pageerror |
none | Hydration mismatch. |
Impact
GTM's snippet sits at the end of the root layout's <body>, so every page fails hydration and the whole document is rebuilt, including the <head> (about 120 elements in our app).
Where
With scripting enabled, the browser parses a <noscript>'s content as text, so the server's <iframe> never exists as an element. React treats noscript as a text-content element and doesn't hydrate its children. Redact appears to hydrate them as elements and finds only text.
Passing the same content as markup hydrates cleanly, and works as a workaround for now:
<noscript dangerouslySetInnerHTML={{ __html: '<iframe src="…" height="0" width="0" style="display:none" title="…"></iframe>' }} />
Related: #43 includes a change that keeps <noscript> content opaque during hydration, which may cover this. It hasn't landed yet and currently conflicts with main.
- Lenguaje dominante
- TypeScript
- Estrellas
- 537
- Forks
- 22
- Merge medio
- 11 h 28 min
- PR fusionados (30 d)
- 34
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de TanStack/redact
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
TanStack/redact#142 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
TanStack/redact#144 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
TanStack/redact#139 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de TanStack/redact
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
-
bug needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
DSpace/dspace-angular#6511 ·
Los mantenedores suelen responder en 1 día
-
area: frontend area:byok bug severity:low
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
Phone app shows Unknown for a remote machine whose key changedPosiblemente ocupada @janicduplessis la tomó hoy. Abiertoarea: mobile priority: P3 type: bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
appandflow/stim#5006 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Area - Local to Cloud Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
microsoft/vscode-mssql#23209 ·
Los mantenedores suelen responder en 1 día