1 Commits
Author SHA1 Message Date
sneak ee77e1236e fix: a refresh asked for while another runs is no longer dropped (closes #581)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
doRefreshAndRender() returned at once when a refresh was already running. An
import asks for a refresh after its address scan. During a refresh, that
request was dropped. The addresses the scan found then 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 19:01:39 +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, a refresh the // Boots the popup over a profile with one wallet. From then on,
// test does not answer never returns. So a refresh that starts another on its // `refreshBalances()` never returns unless the test answers it. So an unwanted
// own is counted and stops, rather than running forever. // refresh is counted once and then waits, instead of starting more.
async function boot() { async function boot() {
const page = await bootPopup(unversionedValidProfile()); const page = await bootPopup(unversionedValidProfile());
expect(page.pageErrors).toEqual([]); expect(page.pageErrors).toEqual([]);
@@ -111,7 +111,7 @@ async function importKey(page, key) {
await page.click("btn-add-wallet-confirm"); await page.click("btn-add-wallet-confirm");
} }
test("addresses an import finds while a refresh runs show their balances once one more refresh returns", async () => { test("addresses that an import finds during a refresh show their balances once one more refresh returns", async () => {
const { page } = await boot(); const { page } = await boot();
const refresh = await holdRefresh(page); const refresh = await holdRefresh(page);
@@ -127,7 +127,7 @@ test("addresses an import finds while a refresh runs show their balances once on
expect(list).toContain("<span>3.0000</span>"); expect(list).toContain("<span>3.0000</span>");
}); });
test("several refreshes asked for while one runs lead to exactly one more", async () => { test("several requests during a refresh lead to exactly one more refresh", async () => {
const { page, refreshBalances } = await boot(); const { page, refreshBalances } = await boot();
const refresh = await holdRefresh(page); const refresh = await holdRefresh(page);
const calls = refreshBalances.mock.calls.length; const calls = refreshBalances.mock.calls.length;
@@ -143,7 +143,7 @@ test("several refreshes asked for while one runs lead to exactly one more", asyn
expect(refreshBalances).toHaveBeenCalledTimes(calls + 1); expect(refreshBalances).toHaveBeenCalledTimes(calls + 1);
}); });
test("a tick of the ten-second timer while a refresh runs queues no other refresh", async () => { test("a tick of the ten-second timer during a refresh starts no other refresh", async () => {
const { page, refreshBalances } = await boot(); const { page, refreshBalances } = await boot();
const refresh = await holdRefresh(page); const refresh = await holdRefresh(page);
const calls = refreshBalances.mock.calls.length; const calls = refreshBalances.mock.calls.length;