mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-24 18:50:56 +08:00
fix(settings): handle undefined content limit in BasicSettings component (#5252)
This commit is contained in:
parent
39008f704d
commit
a3faaa99fb
@ -60,10 +60,12 @@ const BasicSettings: FC = () => {
|
||||
<Input
|
||||
style={{ width: '100px' }}
|
||||
placeholder="2000"
|
||||
value={contentLimit}
|
||||
value={contentLimit === undefined ? '' : contentLimit}
|
||||
onChange={(e) => {
|
||||
const value = e.target.value
|
||||
if (!isNaN(Number(value)) && Number(value) > 0) {
|
||||
if (value === '') {
|
||||
dispatch(setContentLimit(undefined))
|
||||
} else if (!isNaN(Number(value)) && Number(value) > 0) {
|
||||
dispatch(setContentLimit(Number(value)))
|
||||
}
|
||||
}}
|
||||
|
||||
@ -135,7 +135,7 @@ const websearchSlice = createSlice({
|
||||
state.providers.push(action.payload)
|
||||
}
|
||||
},
|
||||
setContentLimit: (state, action: PayloadAction<number>) => {
|
||||
setContentLimit: (state, action: PayloadAction<number | undefined>) => {
|
||||
state.contentLimit = action.payload
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user