From 737f7cada223483e9c3474605e2ecfabdd5342fa Mon Sep 17 00:00:00 2001 From: chamikaJ Date: Tue, 15 Jul 2025 16:11:30 +0530 Subject: [PATCH] refactor(App): streamline cache cleanup process on logout - Removed dynamic import of CacheCleanup in the App component, directly utilizing the imported utility for clearing caches and reloading the application on user logout. - This change simplifies the logout process and improves code readability. --- worklenz-frontend/src/App.tsx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/worklenz-frontend/src/App.tsx b/worklenz-frontend/src/App.tsx index 0f894c3a..0f29cdcd 100644 --- a/worklenz-frontend/src/App.tsx +++ b/worklenz-frontend/src/App.tsx @@ -14,6 +14,7 @@ import router from './app/routes'; import { useAppSelector } from './hooks/useAppSelector'; import { initMixpanel } from './utils/mixpanelInit'; import { initializeCsrfToken } from './api/api-client'; +import CacheCleanup from './utils/cache-cleanup'; // Types & Constants import { Language } from './features/i18n/localesSlice'; @@ -129,11 +130,9 @@ const App: React.FC = memo(() => { event.preventDefault(); // Prevent default browser error handling // Clear caches and reload - import('./utils/cache-cleanup').then(({ default: CacheCleanup }) => { - CacheCleanup.clearAllCaches() - .then(() => CacheCleanup.forceReload('/auth/login')) - .catch(() => window.location.reload()); - }); + CacheCleanup.clearAllCaches() + .then(() => CacheCleanup.forceReload('/auth/login')) + .catch(() => window.location.reload()); } }; @@ -150,11 +149,9 @@ const App: React.FC = memo(() => { event.preventDefault(); // Prevent default browser error handling // Clear caches and reload - import('./utils/cache-cleanup').then(({ default: CacheCleanup }) => { - CacheCleanup.clearAllCaches() - .then(() => CacheCleanup.forceReload('/auth/login')) - .catch(() => window.location.reload()); - }); + CacheCleanup.clearAllCaches() + .then(() => CacheCleanup.forceReload('/auth/login')) + .catch(() => window.location.reload()); } };