⚡ Bolt: [performance improvement] React.memo list optimization#142
⚡ Bolt: [performance improvement] React.memo list optimization#142primoscope wants to merge 1 commit intomainfrom
Conversation
…ssPanel and LogPanel Extracted DownloadItem and LogItem into separate components and wrapped them in React.memo. Added a custom equality check for DownloadItem to handle rapid updates efficiently and used a stable generated ID for LogItem to prevent complete re-renders of the lists when individual items are updated or appended via WebSocket. Helper functions were also moved out of the components to prevent recreation on every render. Co-authored-by: dzp5103 <214723817+dzp5103@users.noreply.github.com>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
💡 What
DownloadItemandLogIteminto separate components and wrapped them inReact.memo().DownloadItemto only re-render when visible primitive fields change.LogItem.🎯 Why
ProgressPanelmapped over active downloads directly in its render block. During high-frequency WebSocket updates (which are common during fast downloads), the entire list of downloads would re-render for every single progress tick.LogPanelmapped over logs and used array indices as keys. Appending a single new log message via WebSocket triggered a re-render of the entire historical log list.📊 Impact
LogPanelwill only render the new log item being appended rather than the entire history.ProgressPanelwill only re-render the specific download item that received a progress or status update, leaving the rest of the active downloads list untouched.🔬 Measurement
DownloadItemcomponent re-renders when its progress changes, instead of the entireProgressPaneland all its children.LogPanel.PR created automatically by Jules for task 6500790666116220388 started by @dzp5103