parkavenue9639 found three things on the tray panel's Allowances tab:
- loadQuotas waited for /api/usage/quotas/history (45 days, and a
remote magpie's too) in one Promise.all with the allowances, so the
skeleton stayed until the curves' history came. The history is now
read on its own (loadQuotaHist); the cards are drawn as soon as the
allowances are in, and drawn again when a history that differs lands.
Of two history reads on their way, the later asked stands.
- The window coming back (focus, visibility) ran renderPanelQuota from
load() and again when the quotas came, each a rebuild of cards that
had not changed (and, while loading, a restart of the skeleton's
shimmer). Those two calls are now lazy: the panel is drawn only when
something it draws from changed (the allowances, a new history, used
or left, the curves' range, folded options, the settings, language,
tab, peek, arranging, or the minute, for its clock deadlines). Every
other caller draws as before.
- renderQuotas went on to build the Usage page's cards, trend and
curves in the panel, which never shows that page. It now stops after
the panel's own draw there.
renderQuotas' local `const mode` (the Used/Left picker) shadowed the
page's mode, so the new panel check hit its temporal dead zone; it is
`pick` now. The fold check `mode !== "panel"` beside it compared that
element, so it was always true; it is dropped, which changes nothing.
Tests: panel-quota-lazy.test.cjs, every language, 440 and 360 wide,
Chromium and WebKit: with the history held the card is drawn and no
skeleton is left; the panel draws no #subscriptionUsage cards; loadBack
with the same answers keeps the card and group nodes; a changed
allowance is drawn.
tray-cell-click waited for the card to be replaced after the window's
focus; with the same allowances it is kept now, so it waits for the
refresh to finish and checks the highlight on the card as drawn. Red
4 of 4 at the old wait, green with the new one.
Run:
- panel-quota-lazy at the old app.js: red in every case; at this change
20 of 20.
- The whole GUI suite (826 files, --test-concurrency=3, load 40 to 90)
at e0abb65ff on b1a2eec2c: 11641 tests, 46 failed in 14 files. Each
of them was run alone at this change:
- green alone: fonts, library-row-remove, market-have, model-copy-id,
panel-profiles, remote-group-served, tray-usages, usage-pack.
- red alone, the same count at the old app.js, filed: quota-count-wrap
and quota-name-translated (#2228), s3-sync (#2448),
usage-agents-hide 22 (#2276), usage-checkin 2 (#2549, #3091),
usage-fold 2 (#2163), usage-ledger 6 (#3104).
- After rebasing onto b0d46ca7f: panel-quota-lazy, tray-cell-click,
i18n-keys, panel-profiles and tray-usages, 53 of 53; go test
./internal/gui (core script budget) ok 4 runs of 5. The first run
printed FAIL and its log was cut by a tail, so which test failed is
not known; the next four were ok.
- Full Go suite at 36890807e (on b0d46ca7f): go test -timeout 45m
./..., 68 packages ok (gateway 550s, agent 442s, gui 205s); gofmt -l
clean.