Skip to content

⚡ Bolt: [performance improvement] Add React.memo for high-frequency WebSocket list rendering#131

Draft
primoscope wants to merge 1 commit intomainfrom
bolt-react-memo-lists-10593381347885775425
Draft

⚡ Bolt: [performance improvement] Add React.memo for high-frequency WebSocket list rendering#131
primoscope wants to merge 1 commit intomainfrom
bolt-react-memo-lists-10593381347885775425

Conversation

@primoscope
Copy link
Copy Markdown
Owner

💡 What:

Added React.memo to DownloadItem (with a custom primitive property equality check) in ProgressPanel.tsx, and LogItem in LogPanel.tsx. Assigned a stable, unique ID to incoming logs instead of relying on array indices.

🎯 Why:

The ProgressPanel and LogPanel components render lists of items. Both lists are updated very frequently via WebSockets.
Because the parent components re-create the entire array objects immutably, all items in the list re-render on every single WebSocket message, even if only one download changed or only one log was appended. This causes significant CPU usage and jank, especially for many active downloads or long log outputs (which maxes at 1000). Array indices as keys on logs also forced complete re-renders when the array shifted.

📊 Impact:

Massively reduces re-renders of unchanged list items. For example, if there are 100 log items and 1 is added, the existing 100 will no longer re-render. If there are 10 active downloads and 1 progresses, the other 9 will not re-render. This drastically improves React rendering performance during high-frequency WebSocket updates and ensures UI stability.

🔬 Measurement:

Verified locally using Playwright integration tests mapping against a mock FastAPI backend. High-frequency simulated WebSocket payload ticks confirmed no regressions and functional state tracking. The TS compilation (pnpm run build) continues to pass successfully.


PR created automatically by Jules for task 10593381347885775425 started by @dzp5103

Added React.memo wrapper components for DownloadItem and LogItem to prevent
expensive array map re-renders on high-frequency WebSocket state updates.

Co-authored-by: dzp5103 <214723817+dzp5103@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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