Skip to content

Commit

Permalink
Fix ssr.
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanCQ committed Sep 11, 2024
1 parent 0883c5b commit f86bfbe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/custom/theme-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Button } from "src/shadcn/ui/button";
import { getTheme, subscribeToTheme, setTheme } from "src/utils/darkMode";

export const useTheme = () => {
const [theme, _setLocalTheme] = React.useState(getTheme());
const [theme, _setLocalTheme] = React.useState(typeof window !== "undefined" ? getTheme() : {mode: 'dark' as const, isDark: true});

React.useEffect(() => {
subscribeToTheme((theme) => _setLocalTheme(theme))
Expand Down

0 comments on commit f86bfbe

Please sign in to comment.