Skip to content

Commit

Permalink
fix: correct effect
Browse files Browse the repository at this point in the history
  • Loading branch information
zobweyt committed Dec 6, 2024
1 parent fc889a4 commit 15bf61c
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ export type ThemeSwitcherItemPreviewProps = {
export const ThemeSwitcherItemPreview = (props: ThemeSwitcherItemPreviewProps) => {
const [theme, setTheme] = createSignal<Theme>(props.value);

if (props.value === "system") {
const prefersDark = usePrefersDark();
createEffect(() => {
if (props.value === "system") {
const prefersDark = usePrefersDark();

createEffect(() => {
setTheme(prefersDark() ? "dark" : "light");
});
}
}
});

return (
<div
Expand Down

0 comments on commit 15bf61c

Please sign in to comment.