From f4310ad8e40cd6c5391bba2273d8b7f2712742b3 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Tue, 14 Mar 2023 00:36:40 +0800 Subject: [PATCH] Add ability to reload hero status --- src/pages/status.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pages/status.jsx b/src/pages/status.jsx index 832e38fd..9135a10a 100644 --- a/src/pages/status.jsx +++ b/src/pages/status.jsx @@ -78,7 +78,7 @@ function StatusPage() { }, [id, uiState !== 'loading']); const scrollOffsets = useRef(); - const initContext = () => { + const initContext = ({ reloadHero } = {}) => { console.debug('initContext', id); setUIState('loading'); let heroTimer; @@ -114,7 +114,7 @@ function StatusPage() { const hasStatus = !!snapStates.statuses[sKey]; let heroStatus = snapStates.statuses[sKey]; - if (hasStatus) { + if (hasStatus && !reloadHero) { console.debug('Hero status is cached'); } else { try { @@ -277,7 +277,9 @@ function StatusPage() { const apiCache = await caches.open('api'); await apiCache.delete(contextURL, { ignoreVary: true }); - return initContext(); + return initContext({ + reloadHero: true, + }); } catch (e) { console.error(e); }