Skip to content

Commit

Permalink
fix(): Immediately load theme if window exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanCQ committed Dec 29, 2023
1 parent 07588d1 commit 3ccbb40
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/molecules/theme-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { theme as _theme } from "src/utils";
type Mode = ReturnType<typeof _theme['get']>['mode']
export const useTheme = () => {

const [theme, _setTheme] = React.useState<ReturnType<typeof _theme['get']>>({mode: "dark", isDark: true});
const [theme, _setTheme] = React.useState<ReturnType<typeof _theme['get']>>(typeof window !== "undefined" ? _theme.get() : {mode: "dark", isDark: true});
React.useEffect(() => {
_theme.subscribe(() => {
_setTheme(_theme.get());
Expand Down

0 comments on commit 3ccbb40

Please sign in to comment.