diff --git a/heph-pwa/src/app.js b/heph-pwa/src/app.js index 6acc2a9..f06ba06 100644 --- a/heph-pwa/src/app.js +++ b/heph-pwa/src/app.js @@ -785,6 +785,23 @@ function buildShell() { async function init() { buildShell(); document.addEventListener("keydown", onKeydown); + + // The PWA shares the daemon's store with the TUI / desktop popover, but only + // re-fetches on a view switch or an action. So another surface marking a task + // done leaves a stale list on screen until then. Re-fetch the current view + // whenever the app regains focus (switching back to the phone, unlock, tab + // re-show) — but not while a modal or search is mid-interaction. + document.addEventListener("visibilitychange", () => { + if ( + document.visibilityState === "visible" && + state.client.configured && + !modalOpen() && + !state.search + ) { + reload(); + } + }); + render(); reload(); diff --git a/heph-pwa/sw.js b/heph-pwa/sw.js index 3ecb45d..571d1e6 100644 --- a/heph-pwa/sw.js +++ b/heph-pwa/sw.js @@ -1,7 +1,7 @@ // Service worker: cache the app shell so heph launches offline. Data is never // cached — every /rpc call must hit the live hub (and POSTs aren't cacheable // anyway). Bump CACHE when shell assets change to evict the old set. -const CACHE = "heph-pwa-v2"; +const CACHE = "heph-pwa-v3"; const SHELL = [ "./", "./index.html",