From d09c91b8383d91246baa8847102a7a96e8c81577 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Tue, 23 Dec 2025 19:42:01 +0530 Subject: [PATCH] [WEB-5772] chore: theme switcher code refactor #8438 --- apps/web/app/(all)/profile/appearance/page.tsx | 4 +--- apps/web/ce/components/preferences/theme-switcher.tsx | 4 +--- .../core/components/power-k/config/preferences-commands.ts | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/apps/web/app/(all)/profile/appearance/page.tsx b/apps/web/app/(all)/profile/appearance/page.tsx index 010431021..d0d05588d 100644 --- a/apps/web/app/(all)/profile/appearance/page.tsx +++ b/apps/web/app/(all)/profile/appearance/page.tsx @@ -63,9 +63,7 @@ function ProfileAppearancePage() { // Wait for the promise to resolve, then reload after showing toast try { await updateCurrentUserThemePromise; - setTimeout(() => { - window.location.reload(); - }, 1500); + window.location.reload(); } catch (error) { // Error toast already shown by setPromiseToast console.error("Error updating theme:", error); diff --git a/apps/web/ce/components/preferences/theme-switcher.tsx b/apps/web/ce/components/preferences/theme-switcher.tsx index 9de9b9616..d6e6dc252 100644 --- a/apps/web/ce/components/preferences/theme-switcher.tsx +++ b/apps/web/ce/components/preferences/theme-switcher.tsx @@ -67,9 +67,7 @@ export const ThemeSwitcher = observer(function ThemeSwitcher(props: { }); // Wait for the promise to resolve, then reload after showing toast await updatePromise; - setTimeout(() => { - window.location.reload(); - }, 1500); + window.location.reload(); } catch (error) { console.error("Error updating theme:", error); } diff --git a/apps/web/core/components/power-k/config/preferences-commands.ts b/apps/web/core/components/power-k/config/preferences-commands.ts index 116b0ddba..6e6ad8e86 100644 --- a/apps/web/core/components/power-k/config/preferences-commands.ts +++ b/apps/web/core/components/power-k/config/preferences-commands.ts @@ -32,9 +32,7 @@ export const usePowerKPreferencesCommands = (): TPowerKCommandConfig[] => { message: "Reloading to apply changes...", }); // reload the page after showing the toast - setTimeout(() => { - window.location.reload(); - }, 1500); + window.location.reload(); return; }) .catch(() => {