renderToReadableStream streams a pending root boundary as fallback + script even after allReady, so react-email output is broken (0.3.1)
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 42/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- nodejs, react, typescript
Piste de recherche
Reproduce with the issue's script under NODE_ENV=production, rendering the same tree through react-dom/server and @tanstack/redact/server, and compare the HTML. Start at the renderToReadableStream server export and trace where suspense boundaries flush: the <!--$?0--> marker, $RC(0) script and hidden S:0 div must not appear once allReady resolves. Done means this repro emits one inline document matching React's output, with no fallback script or hidden segment.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Summary
When everything under the outermost Suspense boundary suspends, Redact's renderToReadableStream still sends that boundary's fallback, the boundary script and a hidden <div id="S:0"> holding the real content, even when the caller waits for allReady before reading. React writes the finished content inline once allReady has resolved.
This breaks every email rendered by react-email under Redact. Its render() wraps the email in <Suspense>, waits for allReady, then reads the stream as a static document. Its Tailwind component suspends while it compiles, so the whole email is pending when the shell flushes. The resulting HTML has a <script>, an empty <div id="B:0">, and the <!DOCTYPE>/<html> nested inside a hidden <div>. Mail clients run no scripts, and a sandboxed preview <iframe> without allow-scripts shows a blank page.
Reproduction
import { Suspense, use } from 'react'
import { renderToReadableStream } from 'react-dom/server'
const data = new Promise((resolve) => setTimeout(() => resolve('Body text'), 20))
function Document() {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<title>Hello</title>
</head>
<body>
<p>{use(data)}</p>
</body>
</html>
)
}
const stream = await renderToReadableStream(
<Suspense>
<Document />
</Suspense>,
{ progressiveChunkSize: Number.POSITIVE_INFINITY },
)
await stream.allReady
console.log(await new Response(stream).text())
Run with Node 26, NODE_ENV=production, once with React's react-dom/server and once with @tanstack/redact/server.
React 19.3.1:
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><title>Hello</title></head><body><!--$--><!--html--><!--head--><!--body--><p>Body text</p><!--/$--></body></html>
Redact 0.3.1 (boundary runtime script shortened):
<!--$?0--><div id="B:0"></div><!--/$--><script>(function(){ /* $RH, $RC, $RL, $RB ... */ })();</script><div hidden id="S:0"><!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><title>Hello</title></head><body><p>Body text</p></body></html></div><script>$RC(0)</script>
A related difference shows up even when nothing is pending at flush time: with the same outer <Suspense>, Redact writes <!--$0--> before <!DOCTYPE html> and <!--/$--> after </html>, so comments sit outside the document element. React writes nothing before the doctype.
Expected
Once allReady has resolved before the first read, every completed boundary is written inline in place, with no fallback, no boundary script and no hidden segment, as React does. This is the pattern static renderers rely on (react-email, and anything else that awaits allReady to get a complete document).
Environment
@tanstack/redact 0.3.1, React 19.3.1, react-email 6.11.16 (@react-email/render 2.3.1), Node 26.13.1.
- Langage dominant
- TypeScript
- Étoiles
- 640
- Forks
- 32
- Merge moyen
- 1 h 15 min
- PR mergées (30 j)
- 7
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de TanStack/redact
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
TanStack/redact#195 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
TanStack/redact#142 · 4 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de TanStack/redact
Issues similaires
-
bug data-types
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
ClickHouse/clickhouse-js#1293 ·
Les mainteneurs répondent en général sous 1 jour
-
area: middleware enhancement good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
-
agent/quality testing
Difficulté 1/5 Moins d'une heure Accessibilité débutants 95/100
Les mainteneurs répondent en général sous 1 jour
-
GitHub registry install via `gh` credentials rewrites `\u0000`–`\u001f` escapes in source files to `^@`–`^_`Peut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 92/100
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
juspay/agent-distro#203 ·
Les mainteneurs répondent en général sous 1 jour