Skip to content

Optimize chat timeline render stability#2982

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/component-performance-optimization-688f
Draft

Optimize chat timeline render stability#2982
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/component-performance-optimization-688f

Conversation

@cursor

@cursor cursor Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Removed React Compiler blockers in MessagesTimeline by replacing render-time ref cache mutation with guarded render-state structural sharing.
  • Replaced dynamic Lucide icon component rendering in work-log rows with static top-level icon components.

Why

react-doctor flagged MessagesTimeline.tsx for performance errors (refs and static-components) that prevented React Compiler optimization on a hot streaming chat path. The new implementation preserves unchanged row references while avoiding ref reads/writes during render, and makes work-log icon rendering compiler-friendly.

UI Changes

No intentional visual UI change. React Scan recordings captured the same timeline pulse interaction before and after:

  • Before: react_scan_timeline_before.mp4
  • After: react_scan_timeline_after.mp4

Video review confirmed the before recording highlighted larger timeline/message wrappers, while the after recording localized highlights to the changing streaming text/timer.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Validation:

  • react-doctor ./apps/web --json --no-score --blocking none (MessagesTimeline.tsx: 3 errors before, 0 errors after)
  • vp check
  • vp run typecheck
  • vp test run --passWithNoTests --project unit src/components/chat/MessagesTimeline.test.tsx
Open in Web View Automation 

Note

Optimize chat timeline render stability in MessagesTimeline

  • Refactors useStableRows to cache a StableRowsSnapshot in React state and update it when the input rows reference changes, replacing the previous useMemo/ref approach for more reliable structural sharing.
  • Extracts createStableRowsSnapshot as a standalone helper to package stable row computation for reuse.
  • Splits icon rendering into two new components, WorkToneIconGlyph and WorkEntryIconGlyph, which return rendered JSX instead of icon types; workToneIconClass now returns only a CSS class string.

Macroscope summarized 53eea2a.

cursoragent and others added 2 commits June 6, 2026 16:20
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jun 6, 2026
@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

🚀 Expo continuous deployment is ready!

  • Project → t3-code
  • Platforms → android, ios
  • Scheme → t3code-preview
  🤖 Android 🍎 iOS
Fingerprint 50af7188c45504c4cf76a4d9ba23a0d6e9b94177 2c1319138333022ef53422fedb7381e34b960fe8
Build Details Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: 50af7188c45504c4cf76a4d9ba23a0d6e9b94177
App version: 0.1.0
Git commit: 5613de62cb8074e598bad4b0c43878ecf118f82a
Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: 2c1319138333022ef53422fedb7381e34b960fe8
App version: 0.1.0
Git commit: 5613de62cb8074e598bad4b0c43878ecf118f82a
Update Details Update Permalink
DetailsBranch: pr-2982
Runtime version: 50af7188c45504c4cf76a4d9ba23a0d6e9b94177
Git commit: 5613de62cb8074e598bad4b0c43878ecf118f82a
Update Permalink
DetailsBranch: pr-2982
Runtime version: 2c1319138333022ef53422fedb7381e34b960fe8
Git commit: 5613de62cb8074e598bad4b0c43878ecf118f82a
Update QR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant