Skip to content

fix(chat,langgraph): jank — stable @for tracking + empty-array guard#174

Merged
blove merged 1 commit into
mainfrom
claude/chat-09-jank-fix
May 2, 2026
Merged

fix(chat,langgraph): jank — stable @for tracking + empty-array guard#174
blove merged 1 commit into
mainfrom
claude/chat-09-jank-fix

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented May 2, 2026

Summary

  • chat: chat-message-list switches @for from track \$index to track message.id. During streaming the messages array can transiently shrink (and previously even briefly empty) — index-based tracking tore down every chat-message DOM element on each emission, resetting the streaming-md renderer state and causing visible flash/missed tokens.
  • langgraph: stream-manager.bridge skips publishing an empty messages array mid-stream (both messages-event and values-event paths). MutationObserver instrumentation showed an empty-array transient between user→assistant emissions; that empty replacement was the upstream cause of the teardown.

Versions

  • @ngaf/chat: 0.0.8 → 0.0.9
  • @ngaf/langgraph: 0.0.2 → 0.0.3

Test plan

  • nx test chat — passes (95 tests)
  • nx test langgraph — passes (95 tests)
  • nx build chat, nx build langgraph — both clean
  • Manual smoke against ngaf-smoke-05 with real OpenAI streaming — verify no chat-message tear-down via MutationObserver

🤖 Generated with Claude Code

@vercel
Copy link
Copy Markdown

vercel Bot commented May 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cacheplane Ready Ready Preview, Comment May 2, 2026 5:13am

Request Review

- chat-message-list: `track message.id` (was `track $index`) so the @for
  doesn't tear down DOM when the messages array briefly shrinks/refills
  during streaming. Loses streaming-md renderer state on every teardown
  → visible flash + missed tokens.
- stream-manager: skip publishing an empty `messages` array during
  streaming (both messages-event and values-event paths). An empty
  payload mid-stream shouldn't wipe the UI; this was the upstream cause
  of the transient empty-array we saw via MutationObserver instrumentation.
- Bumps: @ngaf/chat 0.0.8 → 0.0.9, @ngaf/langgraph 0.0.2 → 0.0.3.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@blove blove force-pushed the claude/chat-09-jank-fix branch from 9b6491f to 4bca3da Compare May 2, 2026 05:11
@blove blove merged commit 2078d89 into main May 2, 2026
14 checks passed
@blove blove deleted the claude/chat-09-jank-fix branch May 7, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant