⚡ Bolt: Optimize high-frequency WebSocket rendering#144
⚡ Bolt: Optimize high-frequency WebSocket rendering#144primoscope wants to merge 1 commit intomainfrom
Conversation
Extracted LogItem and DownloadItem into React.memo components to prevent O(N) re-renders during rapid WebSocket updates. Also moved static helper functions outside the render body and utilized safe, client-generated IDs for logs to ensure stability in non-secure HTTP contexts. 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
LogItemandDownloadItemcomponents wrapped inReact.memo().DownloadItemto only re-render when relevant primitive fields change.formatSpeed,formatETA,getStatusColor,getLogColor) outside the component body.crypto.randomUUID()with a safe, fallback-friendly ID generator (Date.now() + Math.random().toString()) forLogPanelitems.🎯 Why
In React components receiving high-frequency WebSocket updates (like
ProgressPanelandLogPanel), directly rendering arrays of complex items inside the main component body leads to O(N) re-renders. This causes severe CPU spikes during active downloads. Furthermore,crypto.randomUUID()is undefined in non-secure contexts like HTTP, causing erratic behavior in self-hosted environments.📊 Impact
🔬 Measurement
PR created automatically by Jules for task 5281709924120993204 started by @dzp5103