fix(frontend): snap smoothed reveal to full text when the stream ends

⛔ closed · #213 · open-legal-products/mike ← jmooves/mike · opened 2mo ago by jmooves · closed 2mo ago · +8-1 across 1 file · ↗ on GitHub

From the PR description

Problem

User experience: an assistant answer can appear to stop mid-sentence or miss its ending after streaming finishes.

useSmoothedReveal animates the last assistant content event by rendering text.slice(0, revealedInt) while revealedInt catches up to text.length.

The hook's docstring says inactive messages snap to the full text immediately, but the !active branch only updates revealedFloat.current. It does not update revealedInt, which is the state used for rendering.

If streaming ends while the reveal animation is still behind the latest text length, active becomes false and the animation stops. Since revealedInt is never snapped to text.length, the message can remain stuck on a partial prefix and the rest of the assistant response is not shown.

Fix

When active is false, also set revealedInt to text.length, guarded to avoid redundant renders. This makes completed or replayed messages render the full text immediately, while leaving the active streaming animation unchanged.

After the fix, once streaming ends, the message immediately shows the complete assistant response. During active streaming, the smooth reveal behavior stays the same.

Our analysis

Complete assistant messages after streaming — read the full analysis →

Think the analysis missed something the PR description covers?

Capture this PR into my fork

Download a Markdown prompt that tells Claude how to port every commit in this PR into your working tree. Run it via claude -p < capture-pull-213.md from inside the repo you want the changes in.

⬇ Download capture-pull-213.md