fix: themening validation in store init. (#2350)

This commit is contained in:
guru_sainath 2023-10-04 17:44:54 +05:30 committed by GitHub
parent eacf543439
commit 1e9149d872
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,9 +24,12 @@ const MobxStoreInit = () => {
);
// theme
if (store.theme.theme === null && store?.user?.currentUserSettings) {
if (
(store.theme.theme === null || store.theme.theme === "undefined") &&
store?.user?.currentUserSettings
) {
let currentTheme = localStorage.getItem("theme");
currentTheme = currentTheme ? currentTheme : "system";
currentTheme = currentTheme && currentTheme != "undefined" ? currentTheme : "system";
// validating the theme and applying for initial state
if (currentTheme) {