mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-22 17:49:48 +02:00
The live timeline was rendered in a separate <div> from the persisted messages list. When the streamed task finished and its ChatMessage landed, the live <div> unmounted and a new <MessageBubble> mounted — two different DOM elements showing the same content. useAutoScroll's ResizeObserver + MutationObserver fired on both the unmount and the mount, causing the visible jump-then-re-render. Merge the two paths: inject a synthetic assistant message with the pending task_id while streaming, and key every assistant bubble by task_id. When the real message arrives (same task_id), React preserves the DOM element across the invalidate → refetch window — no remount, no double scroll, no flicker. Co-authored-by: Lambda <f252c2c5-7d1d-4f3c-b394-a61abfe673fc@users.noreply.multica.ai>