chore: snapshot current state before cleanup
This commit is contained in:
parent
db4ce8b14f
commit
94e62c9456
14 changed files with 489 additions and 3929 deletions
|
|
@ -294,11 +294,16 @@ function useCardPolling(loadPersistedCards: () => Promise<void>) {
|
|||
const onVisible = () => {
|
||||
if (document.visibilityState === "visible") loadPersistedCards().catch(() => {});
|
||||
};
|
||||
const onCardsRefresh = () => {
|
||||
loadPersistedCards().catch(() => {});
|
||||
};
|
||||
window.addEventListener("focus", onVisible);
|
||||
window.addEventListener("nanobot:cards-refresh", onCardsRefresh);
|
||||
document.addEventListener("visibilitychange", onVisible);
|
||||
return () => {
|
||||
window.clearInterval(pollId);
|
||||
window.removeEventListener("focus", onVisible);
|
||||
window.removeEventListener("nanobot:cards-refresh", onCardsRefresh);
|
||||
document.removeEventListener("visibilitychange", onVisible);
|
||||
};
|
||||
}, [loadPersistedCards]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue