From 588c0efb79fbf3a2142a15f6a453292f2bd798f5 Mon Sep 17 00:00:00 2001 From: Preschian F Date: Fri, 24 Mar 2023 21:00:17 +0700 Subject: [PATCH] fix: clear localStorage and sessionStorage --- utils/cachingStrategy.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/utils/cachingStrategy.ts b/utils/cachingStrategy.ts index c82769e649..fb38183017 100644 --- a/utils/cachingStrategy.ts +++ b/utils/cachingStrategy.ts @@ -62,12 +62,16 @@ export const flushIndexedDb = () => { export const clearSession = () => { try { - window.sessionStorage.clear() - window.localStorage.clear() - flushIndexedDb() + setTimeout(() => { + window.sessionStorage.clear() + window.localStorage.clear() + flushIndexedDb() + }, 100) } catch (error) { console.error(error) } finally { - window.location.reload() + setTimeout(() => { + window.location.reload() + }, 200) } }