mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-03 19:30:04 +08:00
fix: correct updateAssistantPreset reducer to properly update preset (#11453)
The previous implementation used `a = preset` inside forEach, which only reassigns the local variable and doesn't actually update the array element. Changed to use findIndex + direct array assignment to properly update the preset in the state. Fixes #11451 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
bcd7bc9f2d
commit
fd3b7f717d
@ -202,11 +202,10 @@ const assistantsSlice = createSlice({
|
||||
},
|
||||
updateAssistantPreset: (state, action: PayloadAction<AssistantPreset>) => {
|
||||
const preset = action.payload
|
||||
state.presets.forEach((a) => {
|
||||
if (a.id === preset.id) {
|
||||
a = preset
|
||||
}
|
||||
})
|
||||
const index = state.presets.findIndex((a) => a.id === preset.id)
|
||||
if (index !== -1) {
|
||||
state.presets[index] = preset
|
||||
}
|
||||
},
|
||||
updateAssistantPresetSettings: (
|
||||
state,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user