Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

gui: the tray panel draws its last allowances at once and asks for them beside the state (#3160, #3134)

yetone09c0a844bd07
diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css
index 0616a6fa6..2da07aff7 100644
--- a/internal/gui/assets/app.css
+++ b/internal/gui/assets/app.css
@@ -1040,16 +1040,17 @@ body.window .field.solo { grid-column: auto; }
/* Inherited text supplies the inline baseline; the icon shares its centered cell. */
.quota-refresh::before { content: "\00a0"; grid-area: 1 / 1; }
.quota-refresh svg { grid-area: 1 / 1; }
-.subscription-card:hover .quota-refresh, .pq-card:hover .quota-refresh, .quota-refresh.busy, .quota-refresh.kept { width: 14px; margin: 0 -2px 0 3px; opacity: 1; }
+.subscription-card:hover .quota-refresh, .pq-card:hover .quota-refresh, .quota-refresh.busy, .quota-refresh.kept, .quota-refresh.reading { width: 14px; margin: 0 -2px 0 3px; opacity: 1; }
/* apart: Safari before 15.4 drops a whole selector list with :focus-visible in it */
.quota-refresh:focus-visible { width: 14px; margin: 0 -2px 0 3px; opacity: 1; }
.quota-refresh:hover { color: var(--fg); background: var(--pill-hover); }
.quota-refresh.busy { cursor: default; }
-.quota-refresh.busy svg > * { transform-box: view-box; transform-origin: 50% 50%; }
+.quota-refresh.busy svg > *, .quota-refresh.reading svg > * { transform-box: view-box; transform-origin: 50% 50%; }
/* the other place's copy of a control that is turning (the tray panel's and the
- Usage page's draw the same account) turns by itself */
-.quota-refresh.spun svg > * { animation: spin .8s linear infinite; }
-@media (prefers-reduced-motion: reduce) { .quota-refresh.spun svg > * { animation: none; } }
+ Usage page's draw the same account) turns by itself, as does a card kept
+ from the last read while it is read again */
+.quota-refresh.spun svg > *, .quota-refresh.reading svg > * { animation: spin .8s linear infinite; }
+@media (prefers-reduced-motion: reduce) { .quota-refresh.spun svg > *, .quota-refresh.reading svg > * { animation: none; } }
@media (hover: none) { .quota-refresh { width: 14px; margin: 0 -2px 0 3px; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .quota-refresh { transition: none; } }
.skeleton { display: block; border-radius: 5px; background: linear-gradient(90deg, var(--skel, var(--pill)) 25%, var(--skel-hi, var(--pill-hover)) 45%, var(--skel, var(--pill)) 65%); background-size: 240% 100%; animation: skeleton-shift 1.4s ease-in-out infinite; }
diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js
index c2e977100..491f22bf9 100644
--- a/internal/gui/assets/app.js
+++ b/internal/gui/assets/app.js
@@ -4039,6 +4039,12 @@ function fit(extra = 0, glide) {
api("window/fit?h=" + h + (still ? "" : "&ms=" + glide.ms + "&ease=" + glide.ease), {});
}
+// the panel brought up on its Allowances tab is the reader opening them
+// (#1588); the page loaded while the panel is still put away is not
+function panelQuotasNow(again) {
+ panelTab === "usage" && !document.hidden && (again || document.hasFocus()) ? quotasOpened() : loadQuotas();
+}
+
// again: the window came back (focused, or shown again), which only reads
// what is on the page anew. It must not put a page's skeleton up over what
// it shows: under focus-follows-mouse (Hyprland; Zhenzhen on Discord) the
@@ -4053,6 +4059,9 @@ async function load(again) {
try {
const since = prefsWrites, hid = hiddenIds().join(), visibilitySince = agentsVisibilityRevision;
const asked = api("state");
+ // the panel's allowances asked beside the state, not after it (#3134)
+ const early = mode === "panel" && !load.done;
+ if (early) panelQuotasNow(again);
// the first load draws the state magpie kept from its last read while
// the fresh one is read (#1519, fatkun): reading every agent's config,
// and a WSL distro's through \\wsl.localhost, took seconds after a
@@ -4068,6 +4077,7 @@ async function load(again) {
tintPanel();
tintTitleBar();
renderAgents();
+ if (mode === "panel") renderPanelQuota(true);
}
}
let next = await asked;
@@ -4103,9 +4113,7 @@ async function load(again) {
loadInstalls();
// the Providers page made ready behind the one shown (#1519)
if (mode !== "panel" && !(view === "providers" || providersPage(view))) prefetchProviders();
- // the panel brought up on its Allowances tab is the reader opening
- // them (#1588); the page loaded while the panel is still put away is not
- if (mode === "panel") { renderPanelQuota(true); panelTab === "usage" && !document.hidden && (again || document.hasFocus()) ? quotasOpened() : loadQuotas(); }
+ if (mode === "panel") { renderPanelQuota(true); if (!early) panelQuotasNow(again); }
// an open provider editor is someone typing: coming back to the window
// must not rebuild it under them
if ((view === "providers" || providersPage(view)) && !(editing || adding)) await loadProviders();
@@ -15391,6 +15399,12 @@ function rollUpSheet(sheet, then) {
// never waits for them. They don't depend on the period either.
let quotas = null;
let quotasAt = 0; // when they came in
+// the panel's last read, drawn at once, turning, until the read lands (#3160)
+let quotasKept = false;
+if (mode === "panel") try {
+ const kept = JSON.parse(localStorage.getItem("magpie.panelQuotas"));
+ if (Array.isArray(kept)) { quotas = kept; quotasKept = true; }
+} catch {}
let quotaHist = []; // each account's windows over time, for the curves (#651)
// quotasOpened: the reader opened what shows the allowances (the Usage
// page's Overview, the tray panel's Allowances tab, a menu bar cell, either
@@ -15433,14 +15447,15 @@ function loadQuotas(asked, again) {
.then((q) => {
// an answer that isn't a list of cards is a read that failed: what
// was read before stays, as it does when the read is refused
- if (q != null && !Array.isArray(q)) { quotas = quotas || []; reading = false; return; }
+ if (q != null && !Array.isArray(q)) { quotas = quotas || []; quotasKept = reading = false; return; }
q = keepRefreshedQuotas(q || [], began);
// Whole-page reads are serialized; no older one still needs these
// markers. A card reply must not retire them while a GET is pending.
for (const [key, version] of quotaRefreshVersions) if (version <= began) quotaRefreshVersions.delete(key);
same = !!again && !!quotas && JSON.stringify(q || []) === JSON.stringify(quotas);
- quotas = q || []; quotasAt = Date.now();
- }, () => { quotas = quotas || []; reading = false; })
+ quotas = q || []; quotasAt = Date.now(); quotasKept = false;
+ if (mode === "panel") try { localStorage.setItem("magpie.panelQuotas", JSON.stringify(quotas)); } catch {}
+ }, () => { quotas = quotas || []; quotasKept = reading = false; })
.finally(() => {
if (quotasLoading === p) quotasLoading = null;
if (!same) renderQuotas(true);
@@ -17077,7 +17092,8 @@ function renderPanelQuota(lazy) {
const restoreFlash = keepQuotaFlash(box);
box.replaceChildren();
if (none) { quotaFocus = ""; panelArranging = false; fit(); return; }
- if (!quotas) {
+ // kept cards wait for a state to say which are hidden
+ if (!quotas || (quotasKept && !(load.done || state.last))) {
for (let i = 0; i < 2; i++) {
const card = el("div", "pq-card");
card.append(el("span", "skeleton sk-aq"), el("span", "skeleton sk-ring"));
@@ -18106,6 +18122,7 @@ function quotaRefresh(q) {
const kept = [quotaRefreshing.get(key)?.button, keptQuotaRefresh?.get(key)].find((k) => k && !k.isConnected);
const b = kept || el("button", "quota-refresh");
if (quotaRefreshing.has(key) && b !== quotaRefreshing.get(key).button) b.classList.add("busy", "spun");
+ b.classList.toggle("reading", quotasKept);
b.dataset.key = key;
b.type = "button";
b.title = t(q.provider === "claude" ? "Read this card again, by running Claude Code's own /usage" : "Read this card again");
diff --git a/internal/gui/core_budget_test.go b/internal/gui/core_budget_test.go
index 82b721032..5c76ba35b 100644
--- a/internal/gui/core_budget_test.go
+++ b/internal/gui/core_budget_test.go
@@ -15,8 +15,8 @@ import (
// so a page can't quietly grow back into the core; a change that needs more
// raises them and says why in its commit.
const (
- appScriptBudget = 1_322_537 // app.js: 1,198,239 after Usage left (P2); 1,218,098 with the 10-15 fixes to pages still in the core; 1,232,466 with the provider editor's Advanced fold and every dialog holding its place, the core's own (10-16); 1,250,533 with the quota refresh kept through redraws, the core's own since the tray panel draws it too, plus 1.5% (#2397); 1,269,083 with Free first's option in the provider editor's ROUTINGS, which the Routing page reads too, plus 1.5%; 1,272,726 with the Providers page drawing its last list at once (#1519), the core's page, and the Routing trace's account names read without Object.entries (#1481), plus 1.5%; a dialog growing out of the row that opened it and folding back into it, the core's own since every page's dialogs open through it (10-20); Codex's and Claude Code's own settings moved from Settings into the agent's row on the Agents page, the core's own since the tray panel and the window both draw them (10-20); 1,314,432 with Settings › Privacy's record of what was masked (its summary, the records view and the local model's controls), which belongs to Settings, the core's own, plus 1.5%; 1,336,481 with a provider's Names & levels saying Provider in model names is Settings' and opening it there (joe), and Settings' Image recognition saying where a custom provider's model is marked (nexnull), both in the core's own pages, with no room added (10-23); 1,337,633 with Settings › Models › Replies' Intent classifier timeout (#2934, reyoung), Settings' own row, drawn by waitRow, which the Image generation timeout's row now shares, with no room added; 1,337,735 with the provider editor's link naming a partner's page by its own host (siteHost) instead of usemagpie.ai's /go link, the core's own editor, with no room added (10-23); 1,338,084 with Check in now saying what the press came to (claimed +credits, already today, not available yet) where it said "refreshed" (#3326), the check-in row the tray panel draws too, the core's own, with no room added (10-23); 1,338,929 with a new partner's tile keeping a small dot until it is opened, in the add sheet, the core's own, with no room added (10-23); 1,343,324 with the sidebar's open-page row marked by one shape that moves on a spring (navTopGo), the window's own shell, which every page sits beside, with no room added (10-23); 1,343,465 with a dialog kept centred while its content comes in, until it is pressed (holdModal, every page's dialogs), the core's own, with no room added (10-24); 1,317,486 with what masking did moved out to Insights › Masking (plugins/redact), the budget lowered to it (10-24); 1,321,336 with Codex's one subagent model, its card's square saying plainly what each choice does and a row with a name in its sheet, where two squares read alike (the owner), the Agents page's, which the tray panel draws too, the core's own, with no room added (10-24); 1,321,424 with Settings › Models' Image generation MCP server row beside Image recognition's (JonahFu on X), the two drawn by one helper (mcpRow), Settings' own, with no room added (10-25); 1,321,994 with a provider of the user's set never to rest for a limit (zoecats), the provider editor's Advanced row, the core's own editor, with no room added (10-25); 1,322,289 with Settings › Privacy's Keep a key's form under Mask secrets (Charles Cao on X), Settings' own row, with no room added (10-25); 1,322,537 with no Codex squares beside its named settings rows (the owner), with no room added (10-25)
- coreScriptBudget = 1_533_445 // every core script: 1,358,034 after Usage left; 1,380,003 with them; 1,405,937 with the fold; 1,426,102 with 10-16's core work (the GitHub list loading, the move to plugins, Settings › Long conversations), plus 1.5% (#2612); 1,447,368 with loadBack, the window's one state read per return, which every page needs and so is the core's own (1,446,845 before it, 155 bytes under), plus 1.5%; OpenCode Zen's card saying OpenCode tells no key its balance adds ~390 bytes inside it; 1,472,589 with the dialog that grows out of its row and the agents' own settings in their rows, on main's 10-20 core work (the Providers page's last list, the Routing trace's names), plus 1.5% (10-20); 1,506,192 with Settings › Privacy's record of what was masked, plus 1.5%; 1,529,393 with the Intent classifier timeout row (#2934), with no room added; 1,529,495 with the editor's partner link host, with no room added; 1,529,844 with Check in now's press summary (#3326), with no room added; 1,530,689 with the new partner tile's dot, with no room added; 1,535,084 with the sidebar's spring, with no room added; 1,549,478 with the context window card's map (tiles by tokens, the default look, the block grid a switch away) and its text view showing an inline image, in context.js, which the Routing page draws as well as Usage, so the core's own, with no room added (10-24); 1,550,768 with a usage card's refresh opening after its text (#840's card, which the tray panel draws too), the Add key spinner, and a dialog kept centred while its content comes in, with no room added (10-24); 1,524,789 with what masking did moved out to Insights › Masking, lowered to it; 1,528,525 with Codex's one subagent model, with no room added (10-24); 1,528,972 with the Image generation MCP server row (JonahFu on X), with no room added (10-25); 1,529,542 with the limit-rest row (zoecats), with no room added (10-25); 1,529,837 with Keep a key's form (Charles Cao on X), with no room added (10-25); 1,530,050 with no Codex squares beside its named settings rows (the owner), with no room added (10-25); 1,530,631 with a plugin's page growing to its README on the dialog's spring instead of in one jump (the owner), the Plugins page's, in plugins.js, with no room added (10-25); 1,533,445 with the context map counting its tokens on as a live request grows, a tile pointed at keeping its tip, a tool's gathered results saying how many and the small files their folder (the owner, after flohoeller's map on X), in context.js, which the Routing page draws as well as Usage, and the 4 bytes 84c50f032 added to app.js (Settings' Version row) without a raise, with no room added (10-25)
+ appScriptBudget = 1_323_401 // app.js: 1,198,239 after Usage left (P2); 1,218,098 with the 10-15 fixes to pages still in the core; 1,232,466 with the provider editor's Advanced fold and every dialog holding its place, the core's own (10-16); 1,250,533 with the quota refresh kept through redraws, the core's own since the tray panel draws it too, plus 1.5% (#2397); 1,269,083 with Free first's option in the provider editor's ROUTINGS, which the Routing page reads too, plus 1.5%; 1,272,726 with the Providers page drawing its last list at once (#1519), the core's page, and the Routing trace's account names read without Object.entries (#1481), plus 1.5%; a dialog growing out of the row that opened it and folding back into it, the core's own since every page's dialogs open through it (10-20); Codex's and Claude Code's own settings moved from Settings into the agent's row on the Agents page, the core's own since the tray panel and the window both draw them (10-20); 1,314,432 with Settings › Privacy's record of what was masked (its summary, the records view and the local model's controls), which belongs to Settings, the core's own, plus 1.5%; 1,336,481 with a provider's Names & levels saying Provider in model names is Settings' and opening it there (joe), and Settings' Image recognition saying where a custom provider's model is marked (nexnull), both in the core's own pages, with no room added (10-23); 1,337,633 with Settings › Models › Replies' Intent classifier timeout (#2934, reyoung), Settings' own row, drawn by waitRow, which the Image generation timeout's row now shares, with no room added; 1,337,735 with the provider editor's link naming a partner's page by its own host (siteHost) instead of usemagpie.ai's /go link, the core's own editor, with no room added (10-23); 1,338,084 with Check in now saying what the press came to (claimed +credits, already today, not available yet) where it said "refreshed" (#3326), the check-in row the tray panel draws too, the core's own, with no room added (10-23); 1,338,929 with a new partner's tile keeping a small dot until it is opened, in the add sheet, the core's own, with no room added (10-23); 1,343,324 with the sidebar's open-page row marked by one shape that moves on a spring (navTopGo), the window's own shell, which every page sits beside, with no room added (10-23); 1,343,465 with a dialog kept centred while its content comes in, until it is pressed (holdModal, every page's dialogs), the core's own, with no room added (10-24); 1,317,486 with what masking did moved out to Insights › Masking (plugins/redact), the budget lowered to it (10-24); 1,321,336 with Codex's one subagent model, its card's square saying plainly what each choice does and a row with a name in its sheet, where two squares read alike (the owner), the Agents page's, which the tray panel draws too, the core's own, with no room added (10-24); 1,321,424 with Settings › Models' Image generation MCP server row beside Image recognition's (JonahFu on X), the two drawn by one helper (mcpRow), Settings' own, with no room added (10-25); 1,321,994 with a provider of the user's set never to rest for a limit (zoecats), the provider editor's Advanced row, the core's own editor, with no room added (10-25); 1,322,289 with Settings › Privacy's Keep a key's form under Mask secrets (Charles Cao on X), Settings' own row, with no room added (10-25); 1,322,537 with no Codex squares beside its named settings rows (the owner), with no room added (10-25); 1,323,401 with the tray panel drawing its last allowances at once and asking for them beside the state (#3160, #3134), the tray panel's, the core's own, and the 4 bytes 84c50f032 added, with no room added (10-25)
+ coreScriptBudget = 1_534_312 // every core script: 1,358,034 after Usage left; 1,380,003 with them; 1,405,937 with the fold; 1,426,102 with 10-16's core work (the GitHub list loading, the move to plugins, Settings › Long conversations), plus 1.5% (#2612); 1,447,368 with loadBack, the window's one state read per return, which every page needs and so is the core's own (1,446,845 before it, 155 bytes under), plus 1.5%; OpenCode Zen's card saying OpenCode tells no key its balance adds ~390 bytes inside it; 1,472,589 with the dialog that grows out of its row and the agents' own settings in their rows, on main's 10-20 core work (the Providers page's last list, the Routing trace's names), plus 1.5% (10-20); 1,506,192 with Settings › Privacy's record of what was masked, plus 1.5%; 1,529,393 with the Intent classifier timeout row (#2934), with no room added; 1,529,495 with the editor's partner link host, with no room added; 1,529,844 with Check in now's press summary (#3326), with no room added; 1,530,689 with the new partner tile's dot, with no room added; 1,535,084 with the sidebar's spring, with no room added; 1,549,478 with the context window card's map (tiles by tokens, the default look, the block grid a switch away) and its text view showing an inline image, in context.js, which the Routing page draws as well as Usage, so the core's own, with no room added (10-24); 1,550,768 with a usage card's refresh opening after its text (#840's card, which the tray panel draws too), the Add key spinner, and a dialog kept centred while its content comes in, with no room added (10-24); 1,524,789 with what masking did moved out to Insights › Masking, lowered to it; 1,528,525 with Codex's one subagent model, with no room added (10-24); 1,528,972 with the Image generation MCP server row (JonahFu on X), with no room added (10-25); 1,529,542 with the limit-rest row (zoecats), with no room added (10-25); 1,529,837 with Keep a key's form (Charles Cao on X), with no room added (10-25); 1,530,050 with no Codex squares beside its named settings rows (the owner), with no room added (10-25); 1,530,631 with a plugin's page growing to its README on the dialog's spring instead of in one jump (the owner), the Plugins page's, in plugins.js, with no room added (10-25); 1,533,445 with the context map counting its tokens on as a live request grows, a tile pointed at keeping its tip, a tool's gathered results saying how many and the small files their folder (the owner, after flohoeller's map on X), in context.js, which the Routing page draws as well as Usage, and the 4 bytes 84c50f032 added to app.js (Settings' Version row) without a raise, with no room added (10-25); 1,534,312 with the tray panel's last allowances drawn at once (#3160, #3134), with no room added (10-25)
)
func TestCoreScriptBudget(t *testing.T) {
diff --git a/internal/gui/tests/panel-quota-kept.test.cjs b/internal/gui/tests/panel-quota-kept.test.cjs
new file mode 100644
index 000000000..bacb34c0e
--- /dev/null
+++ b/internal/gui/tests/panel-quota-kept.test.cjs
@@ -0,0 +1,88 @@
+// #3160 (yiliang114), #3134 (dakango): the tray panel's Allowances tab
+// stood on skeletons until the whole state had been read and then every
+// vendor's read had come. The allowances last read are kept in the panel's
+// storage and drawn at once, each card's refresh turning until the read
+// lands, and the read is asked for beside the state, not after it. Real
+// page, isolated responses: no vendor, account or installed app is used.
+// MAGPIE_QUOTA_ASSETS points at older assets to see it fail.
+const assert = require("node:assert/strict");
+const fs = require("node:fs/promises");
+const path = require("node:path");
+const { test } = require("node:test");
+const { chromium, webkit } = require("playwright");
+const assets = process.env.MAGPIE_QUOTA_ASSETS || path.resolve(__dirname, "../assets");
+const iso = n => new Date(n).toISOString();
+function fixtures(used) {
+ const now = Date.now(), readAt = iso(now - 60000), resetsAt = iso(now + 2 * 3600000);
+ return [
+ { provider: "codex", name: "Codex", icon: "openai", user: "[email protected]", plan: "Pro", readAt, windows: [{ name: "5 hours", used, resetsAt }] },
+ { provider: "relay", name: "Relay", balance: "$2.00", readAt, windows: [] },
+ ];
+}
+function serve(lang, data) {
+ const settings = { theme: "light", lang, tray: "panel", quotaLeft: false, currency: "usd" };
+ return async route => {
+ const url = new URL(route.request().url()), json = body => route.fulfill({ json: body });
+ if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = ${JSON.stringify({ lang, theme: "light", web: true })};` });
+ if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" });
+ if (url.pathname === "/api/state" && url.searchParams.get("last")) return json({ agents: [], profiles: [], settings, last: true });
+ if (url.pathname === "/api/state") { data.states++; await data.state; return json({ agents: [], profiles: [], settings }); }
+ if (url.pathname === "/api/settings") return json(settings);
+ if (url.pathname === "/api/providers") return json({ providers: [], presets: [], excluded: [], gateway: { running: true, window: true } });
+ if (url.pathname === "/api/usage/quotas") { data.gets++; await data.quotasHeld; return json(data.quotas); }
+ if (url.pathname === "/api/usage/quotas/history") return json([]);
+ if (url.pathname === "/api/usage") return json({ calls: 0, cost: 0, days: [], agents: [], models: [], keys: [] });
+ if (url.pathname === "/api/groups") return json({ groups: [], models: [] });
+ if (url.pathname === "/api/plugins") return json({ plugins: [] });
+ if (url.pathname.startsWith("/api/")) return json({});
+ const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname);
+ const contentType = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png" }[path.extname(file)];
+ try { await route.fulfill({ body: await fs.readFile(file), contentType }); }
+ catch { await route.fulfill({ status: 404, body: "" }); }
+ };
+}
+const card = '#panelQuota .pq-card[data-card="codex|[email protected]"]';
+for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
+ for (const lang of ["en", "zh", "zh-TW", "ja", "de"]) {
+ for (const width of [440, 360]) {
+ test(`${engine} ${lang} ${width}px: the panel draws the allowances last read at once, asks beside the state, and puts the read in their place`, async (t) => {
+ const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
+ t.after(() => browser.close());
+ const page = await browser.newPage({ viewport: { width, height: 640 }, reducedMotion: "reduce" });
+ page.setDefaultTimeout(5000);
+ let giveState, giveQuotas;
+ const data = {
+ quotas: fixtures(75), gets: 0, states: 0,
+ state: new Promise(r => { giveState = r; }), quotasHeld: new Promise(r => { giveQuotas = r; }),
+ };
+ const errors = [];
+ page.on("pageerror", e => errors.push(e.message));
+ await page.addInitScript(kept => {
+ try {
+ if (sessionStorage.getItem("seeded")) return;
+ sessionStorage.setItem("seeded", "1");
+ localStorage.setItem("magpie.panelTab", "usage");
+ localStorage.setItem("magpie.panelQuotas", JSON.stringify(kept));
+ } catch {}
+ }, fixtures(50));
+ await page.route("**/*", serve(lang, data));
+ await page.goto("http://magpie.test/?mode=panel");
+
+ // the state and the read both held: the kept card is drawn, turning
+ await page.locator(`${card} .pq-dial b`, { hasText: "50%" }).waitFor();
+ assert.equal(await page.locator("#panelQuota .skeleton").count(), 0, "no skeleton over the kept cards");
+ assert.ok(await page.locator(`${card} .quota-refresh.reading`).count() > 0, "the kept card's refresh turns");
+ assert.ok(data.gets > 0, "the allowances were asked for before the state came");
+
+ // the state comes, then the read: the read is drawn and stops turning
+ giveState();
+ giveQuotas();
+ await page.locator(`${card} .pq-dial b`, { hasText: "75%" }).waitFor();
+ await page.locator("#panelQuota .quota-refresh.reading").waitFor({ state: "detached" });
+ const kept = await page.evaluate(() => JSON.parse(localStorage.getItem("magpie.panelQuotas")));
+ assert.equal(kept[0].windows[0].used, 75, "the read is kept for the next open");
+ assert.deepEqual(errors, []);
+ });
+ }
+ }
+}