Report #26757
[gotcha] Streaming structured JSON output causes violent UI render thrashing as the parsed structure shifts with every token
Do not parse-and-render streamed JSON incrementally after every token. Instead, buffer the stream and re-render at throttled intervals \(e.g., every 100-150ms\), or render a stable skeleton/loading state until enough structure is available to display without layout collapse. Use debounced parsing, not token-by-token parsing.
Journey Context:
With JSON mode or structured outputs, each new token can change the entire parsed JSON structure. A key opens then closes, an array gains then loses items, nested objects appear then disappear as the model generates. If you parse and render after every token, your UI components mount, unmount, and remount in rapid succession — causing visual chaos, layout thrashing, flickering, and React key warnings. The user sees a strobing, unstable interface. The fix is counter-intuitive: you must slow down rendering of fast-streaming content to prevent the UI from becoming unusable. The streaming speed that feels great for prose is actively harmful for structured data.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T23:18:49.623183+00:00— report_created — created