UI freezes during streaming responses — main thread blocked ~1s per render burst (devtools element instrumentation + renderer commit cost)
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 42/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- playwright, react, typescript
- Bereich
- frontend, performance
Rechercherichtung
Start with dist/core/devtools.js at rememberDevToolsElement() and inspect how the devtools enabled flag is set and checked by neighboring hooks. Then profile the production renderer during the reported streamed token updates, focusing on commit, project(), and reconciliation work. Done means the freeze is reproduced and its production cost is traced, with a fix and regression coverage showing the UI remains responsive.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
In an app rendering with @tanstack/redact (0.3.1) as the React runtime, the UI freezes completely at the start of every streamed AI response — both in dev and production. Longtask observer shows ~1s of main-thread blocking concentrated in the response-start window; frame gaps reach ~1.1s.
Environment
@tanstack/redact: 0.3.1react/react-dom: 19.3.1- Vite 8.3.8 +
@tanstack/react-start1.169.x,redact()plugin - Chrome (headless Chromium via Playwright)
Reproduction
Chat UI that re-renders on every streamed token (TanStack AI useChat → store update → message list render). Send any message; the first visible response freezes the entire page for ~1s, then continues.
Evidence
Dev-mode CPU profile (CDP Profiler, 100µs sampling, 6s window from send):
samples=26877 (~2.7s of 6s)
1.06s 39.4% rememberDevToolsElement dist/core/devtools.js:12
0.50s 18.5% (idle)
0.13s 4.7% (garbage collector)
0.10s 3.7% (program)
... reconcile/commit each <1.5%
Longtasks: 3 tasks ≈ 1037ms inside the first 3s of the stream.
Production build: the same freeze reproduces, so the devtools path (compiled out under NODE_ENV=production) is not the whole story — the renderer's per-commit work during high-frequency updates appears to be the remaining cost.
Root cause (dev path)
dist/core/devtools.js → rememberDevToolsElement() runs for every JSX element in dev and captures new Error("react-stack-top-frame") — a full V8 stack trace — for up to 10k elements/sec, unconditionally, even when devToolsMetadata.enabled === false (no __REACT_DEVTOOLS_GLOBAL_HOOK__ connected). Every other devtools hook early-returns on !enabled; this one doesn't. ~100µs per stack capture × thousands of elements per render burst ≈ the observed ~1s block.
Requested fixes
- Gate the
new Error()capture ondevToolsMetadata.enabled(owner/source metadata can still be recorded — it's just WeakMap writes). - Or add a
redact({ devtools: false })-style flag for apps that don't use the DevTools bridge. - Investigate the production path separately: per-commit
commitDevTools/project()work or reconcile cost under token-rate updates — happy to provide a production CPU profile if useful.
Workaround applied — does NOT fix the bug
bun patch gating the capture on enabled reduced rememberDevToolsElement from 39.4% → 8.6% of dev samples, but the streaming freeze persisted in both dev and production. The patch only removes one measurable cost; it does not address the underlying freeze, which reproduces in the production build where this code path doesn't even exist. We removed Redact from the app entirely — the renderer itself needs investigation under streaming/high-frequency-update load.
- 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