fix: theme cannot be switched (#1157)

This commit is contained in:
Suemor 2024-10-26 17:12:37 +08:00 committed by GitHub
parent 284f3032b1
commit d5be0287ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 5 deletions

View File

@ -5,7 +5,7 @@ import {
SelectTrigger,
SelectValue,
} from "@follow/components/ui/select/index.jsx"
import { useIsDark, useSetTheme, useThemeAtomValue } from "@follow/hooks"
import { useIsDark, useThemeAtomValue } from "@follow/hooks"
import { IN_ELECTRON } from "@follow/shared/constants"
import { getOS } from "@follow/utils/utils"
import { useTranslation } from "react-i18next"
@ -18,6 +18,7 @@ import {
useUISettingValue,
} from "~/atoms/settings/ui"
import { isElectronBuild } from "~/constants"
import { useSetTheme } from "~/hooks/common"
import { SettingTabbedSegment } from "../control"
import { createDefineSettingItem } from "../helper/builder"

View File

@ -20,10 +20,7 @@ export const useSyncThemeWebApp = () => {
export const internal_useSetTheme = () =>
// eslint-disable-next-line react-hooks/rules-of-hooks
useCallback((theme: ColorMode) => jotaiStore.set(themeAtom, theme), [])
export const useSetTheme = () =>
useCallback((colorMode: ColorMode) => {
jotaiStore.set(themeAtom, colorMode)
}, [])
export function disableTransition(disableTransitionExclude: string[] = []) {
const css = document.createElement("style")
css.append(