Dev hydration omits React’s warning for an unexpected attribute on <html>
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 68/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- react, typescript
Rechercherichtung
Start by tracing the development hydration path used by hydrateRoot and compare its handling of unexpected attributes with the React 19.3.1 behavior described here. Use the supplied jsdom reproduction with the extra argument, then check the matching-HTML control. Done means development hydration reports the unexpected element and attribute while preserving the DOM and leaving recoverable errors unused.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
When the DOM has an extra attribute before hydrateRoot(document, …) runs, React 19.3.1 logs a development diagnostic identifying the element and attribute. Redact 0.3.1 hydrates the same document silently. We encountered this in a TanStack Start dev server with the Redact Vite plugin. The standalone reproduction below also triggers it without Vite or a browser extension.
| Development runtime | Matching HTML | Extra data-extra="true" on <html> |
|---|---|---|
| React DOM 19.3.1 | Quiet | One console.error with an attribute diff |
| Redact 0.3.1 | Quiet | No console.error or console.warn |
Both runtimes completed hydration and retained the extra attribute. Neither invoked onRecoverableError. This differs from the text mismatch in #62, where React recovers by re-rendering.
Reproduction
Install [email protected], [email protected], @tanstack/[email protected], and [email protected]. Save this as repro.mjs.
import { JSDOM } from 'jsdom'
const { window } = new JSDOM(
'<!doctype html><html lang="en"><head></head><body><main>Home</main></body></html>'
)
for (const key of ['window', 'document', 'Node', 'Element', 'HTMLElement', 'Text',
'Comment', 'Document', 'DocumentFragment', 'MutationObserver']) {
globalThis[key] = window[key]
}
const redact = process.argv[2] === 'redact'
const { createElement: h } = await import(redact ? '@tanstack/redact' : 'react')
const { hydrateRoot } = await import(redact ? '@tanstack/redact/dom-client' : 'react-dom/client')
if (process.argv[3] === 'extra') document.documentElement.dataset.extra = 'true'
await new Promise(resolve => {
const main = h('main', { ref: node => { if (node) resolve() } }, 'Home')
hydrateRoot(document, h('html', { lang: 'en' }, h('head'), h('body', null, main)), {
onRecoverableError: error => console.log('recoverable:', error.message),
})
})
console.log('Hydrated. data-extra =', document.documentElement.getAttribute('data-extra'))
window.close()
NODE_ENV=development node repro.mjs react extra
NODE_ENV=development node repro.mjs redact extra
Omit extra for the matching-HTML control. React’s diff includes the line - data-extra="true".
Expected behavior
Please report unexpected DOM attributes during development hydration, with enough context to identify the element and attribute. The existing DOM can stay as it is. This would let developers diagnose SSR differences with the Redact plugin enabled.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 640
- Forks
- 32
- Ø Merge
- 1 Std. 15 Min.
- Gemergte PRs (30 T.)
- 7
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus TanStack/redact
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
TanStack/redact#195 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
TanStack/redact#142 · 4 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in TanStack/redact
Ähnliche Issues
-
bug data-types
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
ClickHouse/clickhouse-js#1293 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area: middleware enhancement good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
agent/quality testing
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 95/100
Maintainer antworten meist innerhalb von 1 Tag
-
GitHub registry install via `gh` credentials rewrites `\u0000`–`\u001f` escapes in source files to `^@`–`^_`Evtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 92/100
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
juspay/agent-distro#203 ·
Maintainer antworten meist innerhalb von 1 Tag