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 highlighterTheme = useMemo(() => {
if (codeStyle === 'auto') return theme === ThemeMode.light ? 'one-light' : 'material-theme-darker'
else return codeStyle
if (!codeStyle || codeStyle === 'auto') {
return theme === ThemeMode.light ? 'one-light' : 'material-theme-darker'
}
return codeStyle
}, [theme, codeStyle])
useEffect(() => {

View File

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

View File

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