Repository navigation
Re-render only what changed on each progress update - #151
Merged
anmolkapil merged 1 commit intoOct 16, 2026
Merged
Conversation
App subscribed to every download and to history, so each progress push re-rendered the title bar, status bar, dialogs and the whole screen under them. useNetworkVisuals returned a new function on every render, which defeated DownloadRow's memo, and each row's context menu got a new chosen array, so every row in the list re-rendered on every push. - Select only the shown download, in a CurrentScreen child of App. - Key useNetworkVisuals on the set of known networks and memoize it. - Memoize each list row together with its context menu, passing the selection only to rows that are selected.
Owner
|
🙌🏻 |
This was referenced Nov 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every progress update (about 5 a second per running download) re-rendered much more of the window than changed:
Appsubscribed to all ofdownloadsandhistory, so each update re-rendered the title bar, status bar, dialogs and the whole screen under them.useNetworkVisualsreturned a new function on every render. That defeatedDownloadRow'smemo, despite the comment saying it's stable.chosenarray, so every row in the list re-rendered on every update (~38 components each).Changes
CurrentScreenchild ofAppselects only the shown download.App,TitleBar,StatusBarand the dialogs no longer re-render on progress.useNetworkVisualsderives its colours from the set of known networks (a string key) and memoises the resolver, so it stays the same until a network or preference actually changes.ListedDownload), and only selected rows receive the selection. The menu already useschosenonly when its row is selected (availableActions(selected ? chosen : [item])), so behaviour is unchanged.No visual or behavioural change.
Measured (React commit counting via a DevTools hook plus CDP
Performance.getMetrics, interleaved A/B runs on a loaded machine, so treat the CPU figures as approximate):Lint and typecheck are clean.
ui,downloadActionsandselectionpass, apart fromselection.spec.ts:133, which fails onmaintoo and is fixed by #150.Separately, while measuring I found that the combine diagram's flowing dashes (
stroke-dashoffsetCSS animation) repaint every frame for as long as a download runs. With updates frozen they were most of the remaining renderer CPU (~13% vs ~3% with that animation off). I haven't touched it, since stepping the animation down makes the dashes visibly choppier and that's a design call, but I'm happy to explore options if you're interested.