[WEB-5772] chore: theme switcher code refactor #8438

This commit is contained in:
Anmol Singh Bhatia 2025-12-23 19:42:01 +05:30 committed by GitHub
parent 2bc7080d24
commit d09c91b838
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 9 deletions

View file

@ -63,9 +63,7 @@ function ProfileAppearancePage() {
// Wait for the promise to resolve, then reload after showing toast // Wait for the promise to resolve, then reload after showing toast
try { try {
await updateCurrentUserThemePromise; await updateCurrentUserThemePromise;
setTimeout(() => { window.location.reload();
window.location.reload();
}, 1500);
} catch (error) { } catch (error) {
// Error toast already shown by setPromiseToast // Error toast already shown by setPromiseToast
console.error("Error updating theme:", error); console.error("Error updating theme:", error);

View file

@ -67,9 +67,7 @@ export const ThemeSwitcher = observer(function ThemeSwitcher(props: {
}); });
// Wait for the promise to resolve, then reload after showing toast // Wait for the promise to resolve, then reload after showing toast
await updatePromise; await updatePromise;
setTimeout(() => { window.location.reload();
window.location.reload();
}, 1500);
} catch (error) { } catch (error) {
console.error("Error updating theme:", error); console.error("Error updating theme:", error);
} }

View file

@ -32,9 +32,7 @@ export const usePowerKPreferencesCommands = (): TPowerKCommandConfig[] => {
message: "Reloading to apply changes...", message: "Reloading to apply changes...",
}); });
// reload the page after showing the toast // reload the page after showing the toast
setTimeout(() => { window.location.reload();
window.location.reload();
}, 1500);
return; return;
}) })
.catch(() => { .catch(() => {