From 7315ce08d569b31e194ff739e146016e6ba42da8 Mon Sep 17 00:00:00 2001 From: you Date: Sat, 21 Mar 2026 21:09:48 +0000 Subject: [PATCH] fix: invalidate channel cache before re-fetching on WS update The WS handler's 250ms debounce fired loadChannels() before the global 5s cache invalidation timer cleared the stale entry, so the fetch returned cached data. Now channels.js invalidates its own cache entries immediately before re-fetching. --- public/channels.js | 2 ++ public/index.html | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/public/channels.js b/public/channels.js index f8a18030..b4406dda 100644 --- a/public/channels.js +++ b/public/channels.js @@ -377,8 +377,10 @@ return m.type === 'message' || (m.type === 'packet' && m.data?.decoded?.header?.payloadTypeName === 'GRP_TXT'); }); if (dominated) { + invalidateApiCache('/channels'); loadChannels(true); if (selectedHash) { + invalidateApiCache('/channels/' + encodeURIComponent(selectedHash) + '/messages'); refreshMessages(); } } diff --git a/public/index.html b/public/index.html index 49ea30e8..f9d73d6b 100644 --- a/public/index.html +++ b/public/index.html @@ -22,7 +22,7 @@ - + - - - + + + - - - - + + + + - - + + - +