← Back to PRs

#18824: fix(ui): avoid chat bubble flicker after streaming completes

by cccat6 open 2026-02-17 03:28 View on GitHub →
app: web-ui size: S
## Summary The WebUI chat view could visibly flicker at the end of assistant streaming: the streaming bubble disappeared, then a full-content bubble appeared immediately after. ## Root Cause On `chat` `final` events, the controller cleared stream state before materializing the final assistant message in local chat state. The subsequent history refresh then reintroduced the same message as a separate render pass. ## What Changed - `ui/src/ui/controllers/chat.ts` - On `final`, append an assistant message from payload when valid, otherwise fallback to streamed text, before clearing stream state. - `ui/src/ui/chat/grouped-render.ts` - Remove `fade-in` class from chat bubbles to avoid end-of-stream flash during stream-to-final transition. - Tests - `ui/src/ui/controllers/chat.test.ts`: cover `final` message materialization and payload-vs-stream fallback behavior. - `ui/src/ui/views/chat.test.ts`: assert assistant bubbles are rendered without `fade-in`. ## Validation - `pnpm -C ui exec vitest run src/ui/controllers/chat.test.ts --config vitest.config.ts --browser.enabled false` - `pnpm -C ui exec vitest run src/ui/views/chat.test.ts --config vitest.config.ts`

Most Similar PRs