fix: code style init value

This commit is contained in:
kangfenmao 2024-11-08 11:53:53 +08:00
parent 8491141edc
commit 612b39a878
3 changed files with 10 additions and 3 deletions

View File

@ -24,8 +24,11 @@ export const SyntaxHighlighterProvider: React.FC<PropsWithChildren> = ({ childre
const { codeStyle } = useSettings() const { codeStyle } = useSettings()
const highlighterTheme = useMemo(() => { const highlighterTheme = useMemo(() => {
if (codeStyle === 'auto') return theme === ThemeMode.light ? 'one-light' : 'material-theme-darker' if (!codeStyle || codeStyle === 'auto') {
else return codeStyle return theme === ThemeMode.light ? 'one-light' : 'material-theme-darker'
}
return codeStyle
}, [theme, codeStyle]) }, [theme, codeStyle])
useEffect(() => { useEffect(() => {

View File

@ -24,7 +24,7 @@ const persistedReducer = persistReducer(
{ {
key: 'cherry-studio', key: 'cherry-studio',
storage, storage,
version: 38, version: 39,
blacklist: ['runtime'], blacklist: ['runtime'],
migrate migrate
}, },

View File

@ -669,6 +669,10 @@ const migrateConfig = {
] ]
} }
} }
},
'39': (state: RootState) => {
state.settings.codeStyle = 'auto'
return state
} }
} }