When a provider editor opens, its accounts' readings load after it
(loginUsageOf), and their arrival called renderProviders(true): every
Providers row and the whole editor drawn again. With 600 accounts that
was a second full draw of the editor. redrawAccounts now draws only the
editor's accounts list again and puts it where the old one was. A full
draw is kept for the cases it was there for: another provider being
edited, a rename or a focused field (left alone, as before), and an
arrangement in progress or no open list (drawn in full).
What a full draw did, the in-place redraw does too:
- the list's inputs are named and described as field() names them;
that part of field() is now fieldInputs(label, control), shared;
- the focus goes back to the same control of the same account, matched
by tag and first class (a pressed refresh is "busy", so the whole
className is not the same after), not its index in the list, which
the readings' new controls move;
- that focus is given back, not pressed (modalRefocus), so the dialog
keeps holding the pressed element where it was;
- the body's scroll is put back after the swap: the focused element
taken out moved it by scroll anchoring (120 to 124 in
editor-quota-quiet).
The full draw also hid a gap it no longer covers: the provider editor's
folds learn the labels' column from their own size (edAlign's
ResizeObserver), and the prefs fields (Resets, Warm up, Check in,
Claude Code) shown after the prefs load widen that column without
changing a fold's size. The readings' full draw made new folds that
measured it again. mountProvPrefs now aligns the editor's folds after
showing its fields (edAlignAt, the observer's body made a function).
Measured before (mote, 600 Claude accounts): the in-place redraw saves
~45ms in WebKit and ~30ms in Chromium of the editor's open. The rest
of the ~1s is the first layout of 600 rows.
Tests:
- editor-readings-in-place (new): 12 accounts, readings held until the
editor is open and the 3rd account's first button focused. After
they arrive the Providers row and the editor's head are the nodes
drawn before, the focus is that same button, and the list's labels
match a full renderProviders(true). Chromium and WebKit,
en/zh/zh-TW/ja/de: 10/10 green.
- editor-quota-quiet's "redrawn" watch also counts the accounts list
replaced alone; before, it waited for a new .ebody and failed
"never came, so this tested nothing".
Broken by hand:
- the readings back to renderProviders(true): editor-readings-in-place
10/10 red on "the provider's row is the one drawn before".
- the focus matched by the whole className: account-refresh-holds
red in Chromium, "the focus stays on the pressed refresh" (null).
- the refocus without modalRefocus: account-refresh-holds red, "the
pressed refresh moved 186.875px".
- without the scroll put back: editor-quota-quiet red 8/8, "the body
keeps its scroll" (124, 120).
- without mountProvPrefs' edAlignAt: editor-advanced-align red in
Chromium, "en 1000: Advanced starts at 284.765625, its fields at
349.265625".
Run (mote, load 25-45, other sessions' runs beside):
- account-refresh-holds, claude-quota-onboarding, editor-advanced-align,
editor-hints, editor-quota-quiet, editor-thumbs-batched, one at a
time, on this change and on origin/main 2abfe2b64: the same reds on
both but those this commit fixes, and editor-thumbs-batched (red on
main, #5886, the next commit). The shared reds are filed:
account-refresh-holds' rising sheet (#5814), account-arrange (#6010),
claude-quota-onboarding (#6179), editor-hints in WebKit (#6156).
- the 149 GUI files this reaches, on mote: 2601 pass, 124 fail of 2725.
Every red is in 16 files, and the same 16 run alone at origin/main
2abfe2b64 on mote fail the same tests (126 there, the two more being
signin-proxy at 380px, #5866). Filed: provider-many-keys and
provider-max-output #6209, key-switch #5835, plugin-signin-no-url #5938,
plugin-signed-out-account #5998, reset-providers #6196, old-webkit
#6030/#5919, mobile-web #3952, plugin-move-unserved #4392, key-import
#6416, account-refresh-holds #5814, account-arrange #6010,
claude-quota-onboarding #6179, editor-hints #6156. restart-app's
chromium 420 zh was 1px off once in the full run and green alone on
both trees (#6417).
- go test ./internal/gui -run 'Budget|I18n|Keys|Words' on mica: ok
(TestCoreScriptBudget with the previous commit: -89 code bytes over
both).
At origin/main 70f4593e6 (rebased over 27 commits,
several in app.js): go test ./internal/gui -run
'Budget|I18n|Keys|Words' ok on mote; editor-readings-in-place,
editor-quota-quiet, editor-thumbs-batched, editor-advanced-align,
account-refresh-holds, claude-quota-onboarding, i18n-keys,
signin-proxy, reset-providers and key-import: every red one that is
red on origin/main too, but editor-thumbs-batched's WebKit read
count, which the next commit gives room (red on main as well).
editor-advanced-align was red once in both engines in that set at
--test-concurrency=2 under load, then green alone on this head and on
main, and 58/58 green in the same set again (#6421).
Not tried: the real app with 600 real accounts; Linux WebKitGTK.