Repository navigation
✨ feat: Smooth Streaming Text Fade-In - #14757
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a presentation-layer “smooth streaming” effect so newly streamed words fade in with a short, staggered opacity animation, while keeping the existing streaming/rendering pipeline unchanged and providing a user setting + reduced-motion support.
Changes:
- Introduces a rehype-based word-wrapping fade plugin for markdown streaming plus a lightweight
AnimatedTextfor plain-text reasoning. - Adds a Settings toggle (persisted via Jotai storage atom) and corresponding localization strings.
- Extends markdown streaming benchmarks and adds a dedicated test suite for segmentation/animation behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| client/src/style.css | Adds [data-lc-fade] keyframes + reduced-motion disablement. |
| client/src/store/smoothStreaming.ts | Adds persisted setting atom for smooth streaming toggle. |
| client/src/locales/en/translation.json | Adds UI label + hover help text for the setting. |
| client/src/components/Nav/Settings/registry.tsx | Registers the “Smooth streaming text” toggle under Chat → Messages. |
| client/src/components/Chat/Messages/Content/Parts/Thinking.tsx | Adds optional animated rendering for reasoning text via AnimatedText. |
| client/src/components/Chat/Messages/Content/Parts/Reasoning.tsx | Gates reasoning animation on smoothStreaming + streaming state. |
| client/src/components/Chat/Messages/Content/MarkdownBlocks.tsx | Adds per-block rehype fade plugin instance when animate is enabled. |
| client/src/components/Chat/Messages/Content/MarkdownBlocks.bench.tsx | Extends benchmark to measure fade mode and assert memoization stability. |
| client/src/components/Chat/Messages/Content/Markdown.tsx | Wires smoothStreaming + message submitting state into MarkdownBlocks.animate. |
| client/src/components/Chat/Messages/Content/animate.tsx | Implements word splitting, fade classification/state, rehype plugin, and AnimatedText. |
| client/src/components/Chat/Messages/Content/tests/animate.test.tsx | Adds unit/integration tests for splitting, classification, plugin wrapping, and AnimatedText. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| const WORD_REGEX = /\S+\s*/g; | ||
| const NON_WHITESPACE_REGEX = /\S/; | ||
| const CJK_REGEX = /[\u2E80-\u9FFF\uAC00-\uD7AF\uF900-\uFAFF]/; | ||
|
|
There was a problem hiding this comment.
Hiragana and Katakana are covered: –ヿ sits inside the ⺀-鿿 range (CJK Radicals Supplement through CJK Unified Ideographs, which spans CJK Symbols/Punctuation, Hiragana, Katakana, and Extension A along the way). Verified: /[⺀-鿿가-豈-]/.test('こんにちは') → true, same for 'カタカナ'. Added a kana-only regression test in aefc4de so this stays locked in CI.
Generated by Claude Code
| it('splits CJK runs into smaller segments', () => { | ||
| const parts = splitWords('これは日本語のテストです'); | ||
| expect(parts.join('')).toBe('これは日本語のテストです'); | ||
| expect(parts.length).toBeGreaterThan(1); | ||
| }); |
There was a problem hiding this comment.
Done in aefc4de — added a kana-only case asserting both a Hiragana-only and a Katakana-only string split into multiple segments and round-trip exactly.
Generated by Claude Code
|
@codex review |
Adds a native FlowToken-style fade-in for streamed message text, with no changes to the streaming data path: a per-block rehype plugin wraps newly arrived words in one-shot CSS fade spans, using document-order character offsets so already-visible text never re-animates, even when markdown re-parsing restructures the tree. Words still inside their animation window replay identical props so in-flight fades are never cut short. - New Content/animate.tsx: word splitting (Intl.Segmenter for CJK), offset-based new-text classification, rehype plugin factory, and an AnimatedText component for plain-text reasoning content - MarkdownBlocks: per-block plugin instance appended to the cached rehype plugins only while animating; block memoization untouched (bench asserts identical code-block render counts) - Animation gated on isSubmitting && isLatestMessage and dropped at stream end, so settled messages render without wrapper spans - Skips code, pre, math/KaTeX, artifacts, citations, and MCP UI subtrees - Smooth streaming toggle (default on) under Settings → Chat → Messages; animation disabled under prefers-reduced-motion - Extends the streaming bench with a fade variant (+9% render time in jsdom, 62/62 code-block renders) and adds unit tests for the plugin, classification, and AnimatedText Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DrUMn8aEKtMY2QRZhpheJB
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DrUMn8aEKtMY2QRZhpheJB
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DrUMn8aEKtMY2QRZhpheJB
aefc4de to
7c1d2a0
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aefc4deb3a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| segments.push({ start, value: part, animated: false, delay: 0 }); | ||
| continue; | ||
| } | ||
| if (start >= state.prevCount) { |
There was a problem hiding this comment.
Reset offset tracking when rendered text contracts
When streamed Markdown completes syntax that hides source characters—such as See [OpenAI](https://openai.com becoming See [OpenAI](https://openai.com) for details, or an inline-code span closing—the HAST text count contracts because the URL/markers or code subtree are no longer counted. prevCount still contains the larger prior rendered count, so start >= state.prevCount classifies subsequent new words as old and suppresses their fade until the visible text grows past that stale offset; detect contraction or track stable source positions instead.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The stall described here can't occur: prevCount is re-baselined to the current run's total at the end of every run (now via stageRun/commitRun, previously endRun), not only when text grows. So when a completing link hides URL characters, only the words arriving in that same single render are misclassified as old — the very next render's baseline is already the contracted count and fading resumes immediately. The worst case is a one-render pop of a few words each time a link's syntax completes, which we're accepting rather than paying for two-pass classification or source-position tracking on every token. (The mid-animation active map also keeps already-fading words unaffected by the contraction.)
Generated by Claude Code
| @@ -39,6 +44,7 @@ const Markdown = memo(function Markdown({ content = '', isLatestMessage }: TCont | |||
| remarkPlugins={getRemarkPlugins()} | |||
| rehypePlugins={getRehypePlugins()} | |||
| components={getMarkdownComponents()} | |||
| animate={smoothStreaming && isLatestMessage && isSubmitting} | |||
There was a problem hiding this comment.
Disable the transform when reduced motion is requested
For users with prefers-reduced-motion: reduce, the media query only suppresses the CSS animation; this condition still enables the rehype plugin and AnimatedText, so every streaming update continues splitting and wrapping words in spans despite producing no visual effect. Those users therefore retain the feature's extra parsing, React elements, and DOM cost—particularly significant for long single-block responses—even though the setting text says it is disabled automatically; include the media preference in the render gate rather than relying only on CSS.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 05f648d — useMediaQuery('(prefers-reduced-motion: reduce)') is now part of the animate gate in both Markdown and Reasoning, so reduced-motion users skip the transform and span creation entirely. The CSS media query stays as a second layer of defense.
Generated by Claude Code
| * stream ends so the settled message renders without wrapper spans. | ||
| */ | ||
| export function createFadePlugin(): Plugin<[], Root> { | ||
| const state = createFadeState(); |
There was a problem hiding this comment.
Treat hydrated content as the animation baseline
When an active generation is reopened or resumed after navigation/reload, useResumeOnLoad hydrates the assistant placeholder with the already accumulated response before isSubmitting becomes true. This newly mounted plugin always starts with prevCount: 0, so it classifies the entire historical partial response as new, re-fades every word, and can create a large burst of spans instead of animating only deltas received after attachment; seed the tracker with the hydrated prefix for resumed streams.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 05f648d. Rather than threading the hydrated prefix down from the resume path, the plugin now decides at its own first run: if the first classified run already holds more than FADE_HYDRATION_THRESHOLD (120) characters, that content is treated as the baseline — nothing animates and prevCount is seeded to the full length, so only deltas received after attachment fade. A genuinely fresh stream's first per-frame delta is far below the threshold, so normal first-word animation is unaffected. Covered by new tests for both the rehype plugin and AnimatedText.
Generated by Claude Code
|
|
||
| export function endRun(run: FadeRun): void { | ||
| const { state, now } = run; | ||
| state.prevCount = run.count; |
There was a problem hiding this comment.
Commit fade state only after React commits the render
With the React 18 concurrent root, this transformer and AnimatedText update prevCount, active, and animation timestamps while rendering, before React has committed any corresponding DOM. If a streaming render is interrupted or abandoned by a higher-priority update, the tracker still advances; a later committed render can then classify never-displayed deltas as old, or remove their fade after measuring the animation window from the abandoned render. Keep render-time classification transactional and publish the new tracker state only after the render commits.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 05f648d. Classification no longer mutates committed state during render: each run stages its result (stageRun) — new-animation entries and the next baseline offset — and MarkdownBlock publishes it via fade.commit() in a useLayoutEffect (same for AnimatedText). An abandoned render's staged run is simply overwritten by the next render, so never-displayed deltas are re-classified as new when they actually commit. Added a test asserting a never-committed render re-classifies identically.
Generated by Claude Code
…tion Addresses Codex review on the smooth streaming fade: - Hydrated/resumed content becomes the animation baseline: a renderer whose first run already exceeds FADE_HYDRATION_THRESHOLD (reconnected stream, conversation switch) no longer re-fades the entire accumulated response - Classification is now transactional under React 18 concurrency: runs are staged during render and published via commit() from a layout effect, so abandoned renders (interruption, StrictMode double-render) leave no trace - prefers-reduced-motion now disables the rehype transform and AnimatedText in the render gate, not just the CSS animation, so reduced-motion users skip the span-wrapping work entirely Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DrUMn8aEKtMY2QRZhpheJB
|
@codex review Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 05f648d7c2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const state = createFadeState(); | ||
| const plugin: Plugin<[], Root> = function rehypeFade() { | ||
| return (tree: Root) => { | ||
| const suppress = state.firstRun && countText(tree) > FADE_HYDRATION_THRESHOLD; |
There was a problem hiding this comment.
Use a real hydration signal for first runs
When a resumed response contains 120 characters or fewer, this condition treats the historical prefix as new and re-fades it; conversely, because MarkdownBlocks creates one plugin per block, a genuinely new paragraph first delivered in a chunk over 120 characters is treated as hydrated and receives no fade. Fresh evidence in this revision is that hydration is inferred solely from each renderer's text length, so the earlier resume issue remains for short prefixes and introduces false suppression for large new blocks; pass an explicit hydrated/baseline signal instead.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 72c4421 — hydration is now an explicit signal rather than a per-block length guess. Markdown captures whether substantial content already exists at the render where its animate gate flips on (the actual resume/switch/follow-up moment) and passes hydrated to each block's plugin; the flag clears after that render commits. So a genuinely new paragraph delivered in one large chunk mid-stream always animates (the false-suppression case), and resumed content becomes the baseline across all its blocks regardless of individual block sizes. The one remaining heuristic is the whole-message threshold at flip time, needed to distinguish a resume from a fresh stream's first delta — a sub-120-char resumed prefix briefly re-fades, which is visually harmless.
Generated by Claude Code
| <ThinkingContent | ||
| animate={smoothStreaming && !reducedMotion && effectiveIsSubmitting && isLast} | ||
| > |
There was a problem hiding this comment.
Skip word animation while reasoning is collapsed
With the default showThinkingAtom value of false, the reasoning panel is height-collapsed but remains mounted, and this condition still enables AnimatedText throughout generation. For long reasoning streams that means repeatedly splitting the entire accumulated text and maintaining one React node per word even though none of the animation is visible; gate the transform on expansion (while preserving an appropriate baseline when the panel opens) so the default collapsed path keeps rendering the raw string. CLAUDE.mdL54-L60
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 72c4421 — the animate gate now includes isExpanded, so collapsed reasoning renders the raw string with zero transform work. Expanding mid-stream mounts AnimatedText fresh with the accumulated backlog, which its hydration baseline treats as already-seen — only deltas after expansion fade.
Generated by Claude Code
| if (CJK_REGEX.test(token)) { | ||
| pushCjkParts(parts, token); |
There was a problem hiding this comment.
Segment all scripts that do not use spaces
For Thai, Lao, Khmer, Burmese, and other scripts that normally omit spaces, this condition never calls Intl.Segmenter, so the entire growing text is one part whose start offset remains zero. Once that part's initial animation window expires, later appended characters have start < prevCount and no active entry, meaning the rest of a continuously streamed response never fades; apply word segmentation to all supported scripts rather than limiting it to these CJK/Hangul ranges.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 72c4421 — the segmentation trigger now covers Thai, Lao, Tibetan, Myanmar, and Khmer ranges in addition to CJK/Hangul (SPACELESS_REGEX), all routed through the same Intl.Segmenter path (verified ICU segments each of these correctly). Added Thai and Burmese round-trip segmentation tests.
Generated by Claude Code
…soning Second Codex review round on the smooth streaming fade: - Hydration is now an explicit signal instead of a per-block length guess: Markdown captures whether substantial content already exists at the render where its animate gate flips on, and passes it to each block's plugin. New blocks mounting later in the stream always animate regardless of size, and resumed content becomes the baseline regardless of block sizes - Word segmentation now covers all spaceless scripts (Thai, Lao, Tibetan, Myanmar, Khmer) in addition to CJK/Hangul, so continuously streamed text in those scripts keeps fading instead of freezing after the first window - Reasoning text no longer runs the word transform while the thinking panel is collapsed; expanding mid-stream starts from a hydrated baseline Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DrUMn8aEKtMY2QRZhpheJB
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
The word fade itself signals streaming, so the trailing block cursor (result-streaming) and the pulsing thinking dot (result-thinking) are now suppressed whenever the smooth streaming fade is enabled. Both return when the setting is off or the device prefers reduced motion. Extracts the shared gate into a useSmoothStreaming hook consumed by Markdown, Reasoning, TextPart, DisplayMessage, EmptyText, and the legacy loading fallback. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DrUMn8aEKtMY2QRZhpheJB
The pulsing thinking cursor now only renders while the smooth streaming fade is off, so the tests asserting it set the toggle off first (at file level where earlier renders would cache the atom's first read). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DrUMn8aEKtMY2QRZhpheJB
The trailing streaming cursor stays hidden while the fade is active (the fade itself signals text arriving), but the pre-first-token dot returns: nothing else tells the user the run started before any text exists. Restyled to match the word fade rather than the classic size throb — it fades in on the same 250ms ease-out curve, then breathes on opacity, so "run starting" and "text arriving" read as one system. Applied only when the fade is active; with the setting off or reduced motion preferred the dot keeps its original pulseSize behavior, so the cursor assertions in the existing suites hold unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DrUMn8aEKtMY2QRZhpheJB
* 🚣♀️ feat: Smooth Streaming Text Fade-In Adds a native FlowToken-style fade-in for streamed message text, with no changes to the streaming data path: a per-block rehype plugin wraps newly arrived words in one-shot CSS fade spans, using document-order character offsets so already-visible text never re-animates, even when markdown re-parsing restructures the tree. Words still inside their animation window replay identical props so in-flight fades are never cut short. - New Content/animate.tsx: word splitting (Intl.Segmenter for CJK), offset-based new-text classification, rehype plugin factory, and an AnimatedText component for plain-text reasoning content - MarkdownBlocks: per-block plugin instance appended to the cached rehype plugins only while animating; block memoization untouched (bench asserts identical code-block render counts) - Animation gated on isSubmitting && isLatestMessage and dropped at stream end, so settled messages render without wrapper spans - Skips code, pre, math/KaTeX, artifacts, citations, and MCP UI subtrees - Smooth streaming toggle (default on) under Settings → Chat → Messages; animation disabled under prefers-reduced-motion - Extends the streaming bench with a fade variant (+9% render time in jsdom, 62/62 code-block renders) and adds unit tests for the plugin, classification, and AnimatedText Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DrUMn8aEKtMY2QRZhpheJB * 🔧 chore: Fix Import Order in Markdown and Settings Registry Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DrUMn8aEKtMY2QRZhpheJB * ✅ test: Cover Kana-Only CJK Word Segmentation Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DrUMn8aEKtMY2QRZhpheJB * 🛡️ fix: Harden Streaming Fade for Resume, Concurrency, and Reduced Motion Addresses Codex review on the smooth streaming fade: - Hydrated/resumed content becomes the animation baseline: a renderer whose first run already exceeds FADE_HYDRATION_THRESHOLD (reconnected stream, conversation switch) no longer re-fades the entire accumulated response - Classification is now transactional under React 18 concurrency: runs are staged during render and published via commit() from a layout effect, so abandoned renders (interruption, StrictMode double-render) leave no trace - prefers-reduced-motion now disables the rehype transform and AnimatedText in the render gate, not just the CSS animation, so reduced-motion users skip the span-wrapping work entirely Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DrUMn8aEKtMY2QRZhpheJB * 🌏 fix: Refine Fade Hydration Signal, Spaceless Scripts, Collapsed Reasoning Second Codex review round on the smooth streaming fade: - Hydration is now an explicit signal instead of a per-block length guess: Markdown captures whether substantial content already exists at the render where its animate gate flips on, and passes it to each block's plugin. New blocks mounting later in the stream always animate regardless of size, and resumed content becomes the baseline regardless of block sizes - Word segmentation now covers all spaceless scripts (Thai, Lao, Tibetan, Myanmar, Khmer) in addition to CJK/Hangul, so continuously streamed text in those scripts keeps fading instead of freezing after the first window - Reasoning text no longer runs the word transform while the thinking panel is collapsed; expanding mid-stream starts from a hydrated baseline Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DrUMn8aEKtMY2QRZhpheJB * 🖱️ feat: Hide Streaming Cursors While Smooth Fade Is Active The word fade itself signals streaming, so the trailing block cursor (result-streaming) and the pulsing thinking dot (result-thinking) are now suppressed whenever the smooth streaming fade is enabled. Both return when the setting is off or the device prefers reduced motion. Extracts the shared gate into a useSmoothStreaming hook consumed by Markdown, Reasoning, TextPart, DisplayMessage, EmptyText, and the legacy loading fallback. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DrUMn8aEKtMY2QRZhpheJB * ✅ test: Pin Cursor Assertions to Fade-Off State The pulsing thinking cursor now only renders while the smooth streaming fade is off, so the tests asserting it set the toggle off first (at file level where earlier renders would cache the atom's first read). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DrUMn8aEKtMY2QRZhpheJB * 💫 feat: Restore Start-of-Run Dot With Fade-Matched Treatment The trailing streaming cursor stays hidden while the fade is active (the fade itself signals text arriving), but the pre-first-token dot returns: nothing else tells the user the run started before any text exists. Restyled to match the word fade rather than the classic size throb — it fades in on the same 250ms ease-out curve, then breathes on opacity, so "run starting" and "text arriving" read as one system. Applied only when the fade is active; with the setting off or reduced motion preferred the dot keeps its original pulseSize behavior, so the cursor assertions in the existing suites hold unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DrUMn8aEKtMY2QRZhpheJB --------- Co-authored-by: Claude <noreply@anthropic.com>
Summary
Native FlowToken-style smooth streaming: newly streamed words fade in with a subtle staggered opacity animation, purely as a presentation-layer effect — the streaming data path (rAF-coalesced delta flush, per-block markdown memoization) is untouched, and token delivery rate is unchanged (pacing stays server-side).
How it works
After researching FlowToken, Vercel's streamdown, llm-ui, and the AI SDK's
smoothStream, this adopts streamdown's architecture (the approach Claude.ai uses), which is the only one whose "don't re-animate old text" mechanism survives markdown re-parsing — FlowToken's per-node ref/key diffing flickers whenever a re-parse moves text between elements (e.g.**boldcompleting into<strong>).Content/animate.tsx— a rehype plugin factory. The transform walks the HAST in document order, splits text into word parts (whitespace attached to its word;Intl.Segmenterfor CJK, which whitespace-splitting can't handle), and wraps them in<span data-lc-fade>driving a one-shot 250ms CSS opacity animation with a capped 25ms stagger.duration: 0msand cuts their fade short. This also means a word growing at the stream head (hel→hello) keeps fading rather than restarting.MarkdownBlock, appended to the cached rehype plugin array only while animating. Since only the last, still-growing block re-runs the pipeline, settled blocks never even execute the transform. The block memo comparator gains only ananimatecheck.smoothStreaming && isLatestMessage && isSubmitting(both signals already inMessageContext, covering the content-parts and legacy text paths). When the stream ends the plugin is dropped and the settled message re-renders once with zero wrapper spans — clean DOM, clean copy/paste.code/pre, math/KaTeX output, artifacts, citations, and MCP-UI subtrees are never wrapped (FlowToken's per-word code-block animation is a documented perf drag).ThinkingContentgets the same treatment via a lightweightAnimatedTextcomponent (plain text, no markdown — nearly free).@media (prefers-reduced-motion: reduce)disables the animation regardless of the toggle. The streaming cursor (.result-streaming …:last-child:after) is unaffected since spans live inside the last block element.Performance
Measured two ways, both comparing current
mainbehavior vs. fade enabled.1. jsdom Profiler bench (extended
MarkdownBlocks.bench.tsx, committed — 9KB message with 12 code blocks + tables, 80 stream steps):The bench now asserts the fade cannot disturb block memoization (identical code-block render counts).
2. react-scan + frame timing in headless Chromium (Vite dev server harness streaming an 8-section markdown fixture with code blocks/tables at ~60 words/s, react-scan
onRenderaggregation + rAF frame deltas + PerformanceObserver long tasks, 3 iterations averaged):MarkdownBlocks323 renders in both modes,CodeBlock1340 vs 1341.Follow-ups (not in this PR)
blurInvariant (blur masks chunk boundaries on very fast models — streamdown's recommendation) as a second animation style.Change Type
Testing
client:npx jest src/components/Chat/Messages/Content/__tests__/animate.test.tsx— 12 new tests covering word splitting (round-trip, CJK), classification (stagger cap, whitespace, append-only detection, mid-window prop replay, growing head word), the rehype plugin through realReactMarkdownrenders (skip lists, streamed re-renders, restructuring around**final**), andAnimatedText.MarkdownBlocks,MermaidBlockIds,Markdown.mcpui,MarkdownBlocks.artifacts,Part,ContentParts,Translation.spec) all pass — 82 tests total.node node_modules/jest/bin/jest.js --runInBand --coverage=false --testMatch '**/MarkdownBlocks.bench.tsx'fromclient/(numbers above).<Markdown>pipeline in headless Chromium with react-scanonRenderaggregation, rAF frame deltas, and long-task observation, at 1× and 4× CPU throttle (numbers above; harness not committed).npx tsc --noEmitclean (one pre-existing unrelated error inlib/rum/useRum.ts); ESLint andnpm run sort-imports:checkclean on all touched files.Test Configuration:
Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_01DrUMn8aEKtMY2QRZhpheJB