Skip to content

⚡ Bolt: [performance improvement] Optimize Progress and Log Panel re-renders#125

Draft
primoscope wants to merge 1 commit intomainfrom
bolt-optimize-frontend-re-renders-15880277296549731960
Draft

⚡ Bolt: [performance improvement] Optimize Progress and Log Panel re-renders#125
primoscope wants to merge 1 commit intomainfrom
bolt-optimize-frontend-re-renders-15880277296549731960

Conversation

@primoscope
Copy link
Copy Markdown
Owner

💡 What: Implemented React.memo with custom equality checks and stable keys to prevent unnecessary re-renders in the ProgressPanel and LogPanel components. Pure helper functions were also extracted out of component bodies.
🎯 Why: The downloads and logs arrays are updated very frequently via WebSocket and polling. Previously, appending a single log or updating a single download's progress would force every single item in those lists to re-render, causing unnecessary CPU work and potential UI stutter.
📊 Impact: Drastically reduces React render cycle cost for high-frequency updates. Only the specific DownloadItem or LogItem that receives new data will re-render, reducing main-thread blocking during intense downloading.
🔬 Measurement: Verify by starting a download or triggering logs, and using React Developer Tools Profiler with "Highlight updates when components render" enabled to observe that only updated rows re-render.


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

…nent re-renders

- Refactored `ProgressPanel.tsx` to memoize individual download items (`DownloadItem`).
- Implemented a custom equality function for `React.memo` in `DownloadItem` to accurately compare primitive progress values instead of object references, preventing unnecessary re-renders when polling replaces the entire `downloads` array.
- Refactored `LogPanel.tsx` to memoize individual log lines (`LogItem`).
- Added a client-side generated unique `id` to `LogMessage` objects when they are received via WebSocket, enabling stable React keys and preventing full-list re-renders when the logs array is sliced.
- Moved pure helper functions (`formatSpeed`, `formatETA`, `getStatusColor`, `getLogColor`) outside of component bodies to avoid recreation on every render.
- Added explanatory comments for the optimizations.

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