Skip to content

Commit

Permalink
fix: apply disableTransition
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoban committed Jun 3, 2024
1 parent f0151bf commit d334a6c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/atom-dark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export function atomDark(options?: Options) {
const theme = get(themeAtom)
const isSystemDark = get(isSystemDarkAtom)
const isDark = isDarkMode(theme, isSystemDark)
const enable = disableTransition
? disableAnimation(disableTransitionExclude)
: null
applyDarkMode(isDark)
enable?.()

if (
(theme === 'dark' && isSystemDark)
Expand All @@ -47,17 +51,12 @@ export function atomDark(options?: Options) {
return isDarkMode(theme, isSystemDark)
},
(get, set) => {
const enable = disableTransition
? disableAnimation(disableTransitionExclude)
: null
const theme = get(themeAtom)
const isSystemDark = get(isSystemDarkAtom)
if (theme === 'system')
set(themeAtom, isSystemDark ? 'light' : 'dark')
else
set(themeAtom, 'system')

enable?.()
},
)
return anAtom
Expand Down

0 comments on commit d334a6c

Please sign in to comment.