1 Commits
Author SHA1 Message Date
sneak fa83b96722 fix: a refresh asked for while another runs is no longer dropped (closes #581)
check / check (push) Canceled after 0s
e2e / e2e-chrome (push) Canceled after 0s
e2e / e2e-firefox (push) Canceled after 0s
doRefreshAndRender() returned at once when a refresh was already running. An
import asks for a refresh after its address scan, so the addresses the scan
found showed 0.0000 until the next ten-second refresh.

While a refresh runs, a request through ctx now sets a flag. One more refresh
runs once the running one ends. Several requests in that time lead to one more
refresh, not several. A tick of the ten-second timer that finds a refresh
running is still dropped.

Model: opus-5-5
2026-10-27 18:05:24 +00:00
+6 -6
View File
@@ -46,9 +46,9 @@ async function readChain(wallets) {
}
}
// Boots the popup over a profile with one wallet. From then on,
// `refreshBalances()` never returns unless the test answers it. So an unwanted
// refresh is counted once and then waits, instead of starting more.
// Boots the popup over a profile with one wallet. From then on, a refresh the
// test does not answer never returns. So a refresh that starts another on its
// own is counted and stops, rather than running forever.
async function boot() {
const page = await bootPopup(unversionedValidProfile());
expect(page.pageErrors).toEqual([]);
@@ -111,7 +111,7 @@ async function importKey(page, key) {
await page.click("btn-add-wallet-confirm");
}
test("addresses that an import finds during a refresh show their balances once one more refresh returns", async () => {
test("addresses an import finds while a refresh runs show their balances once one more refresh returns", async () => {
const { page } = await boot();
const refresh = await holdRefresh(page);
@@ -127,7 +127,7 @@ test("addresses that an import finds during a refresh show their balances once o
expect(list).toContain("<span>3.0000</span>");
});
test("several requests during a refresh lead to exactly one more refresh", async () => {
test("several refreshes asked for while one runs lead to exactly one more", async () => {
const { page, refreshBalances } = await boot();
const refresh = await holdRefresh(page);
const calls = refreshBalances.mock.calls.length;
@@ -143,7 +143,7 @@ test("several requests during a refresh lead to exactly one more refresh", async
expect(refreshBalances).toHaveBeenCalledTimes(calls + 1);
});
test("a tick of the ten-second timer during a refresh starts no other refresh", async () => {
test("a tick of the ten-second timer while a refresh runs queues no other refresh", async () => {
const { page, refreshBalances } = await boot();
const refresh = await holdRefresh(page);
const calls = refreshBalances.mock.calls.length;