Skip to content

⚡ Bolt: [performance improvement] Optimize React list re-renders#129

Draft
primoscope wants to merge 1 commit intomainfrom
bolt/memoize-react-list-items-5232294437624481220
Draft

⚡ Bolt: [performance improvement] Optimize React list re-renders#129
primoscope wants to merge 1 commit intomainfrom
bolt/memoize-react-list-items-5232294437624481220

Conversation

@primoscope
Copy link
Copy Markdown
Owner

💡 What: Extracted list rendering logic into React.memo components (LogItem and DownloadItem) in the LogPanel and ProgressPanel. Implemented safe, stable client-side IDs for logs and custom equality functions for downloads to handle frequent data replacements.

🎯 Why: Previously, the frontend would re-render the entire history of logs every time a single new log arrived over WebSocket because index was used as a key. Similarly, the 5-second API polling fallback for ProgressPanel fully replaced the downloads array, generating new object references that bypassed standard shallow React comparisons, causing full UI recalculations across all active downloads.

📊 Impact: Significantly reduces CPU overhead and main-thread blocking by isolating re-renders to only the specific item that has changed (e.g. only the currently active download progresses). Prevents O(N) re-rendering scaling issues in the log view.

🔬 Measurement: Verify by running the application and observing React DevTools Profiler during an active download; only the specific DownloadItem processing should "flash" as re-rendering, and appending new logs will not trigger renders on older log items. Backend testing passes fully.


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

…d Progress panels

Implemented `React.memo` for individual list items in `LogPanel` and `ProgressPanel` to prevent full list re-renders on high-frequency WebSocket and polling updates.
- Added stable generated client IDs for logs to replace index keys.
- Implemented custom equality functions in `DownloadItem` to handle object reference changes caused by the 5-second API polling fallback.
- Addressed TypeScript typing issues by omitting explicit `React.FC` on memoized components.

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