Force-refresh header balances after transfers and balance SSE events.

Invalidate balance caches on mutation, push SSE balance tick, and bypass 60s cache when refreshing funds.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-12 09:03:15 +08:00
parent bb53beb22d
commit 5eb9b9f5c5
10 changed files with 63 additions and 13 deletions
+4 -3
View File
@@ -32,12 +32,13 @@
}
}
function scheduleRefresh() {
function scheduleRefresh(opts) {
if (refreshTimer) return;
const options = opts || {};
refreshTimer = setTimeout(function () {
refreshTimer = null;
if (document.hidden) return;
refreshTabData(currentTab(), { silent: true });
refreshTabData(currentTab(), { silent: true, force: !!options.force });
}, 80);
}
@@ -52,7 +53,7 @@
}
if (ver === localLiveVersion) return;
localLiveVersion = ver;
scheduleRefresh();
scheduleRefresh({ force: reason === "balance" });
}
function closeLiveStream() {