[WEB-1465] fix: theme fluctuation on initial load. (#4638)

This commit is contained in:
Prateek Shourya 2024-05-29 18:21:33 +05:30 committed by GitHub
parent 8a30c2c484
commit 10ef4e657f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,7 +14,7 @@ type TStoreWrapper = {
const StoreWrapper: FC<TStoreWrapper> = observer((props) => {
const { children } = props;
// theme
const { setTheme } = useTheme();
const {resolvedTheme, setTheme } = useTheme();
// router
const router = useRouter();
// store hooks
@ -38,7 +38,7 @@ const StoreWrapper: FC<TStoreWrapper> = observer((props) => {
* Setting up the theme of the user by fetching it from local storage
*/
useEffect(() => {
setTheme(userProfile?.theme?.theme || "system");
setTheme(userProfile?.theme?.theme || resolvedTheme || "system");
if (!userProfile?.theme?.theme) return;
if (userProfile?.theme?.theme === "custom" && userProfile?.theme?.palette) {