From fd3b7f717d90bea54f8798c21e75b7096ff94092 Mon Sep 17 00:00:00 2001 From: fullex <106392080+0xfullex@users.noreply.github.com> Date: Tue, 25 Nov 2025 20:59:56 +0800 Subject: [PATCH] fix: correct updateAssistantPreset reducer to properly update preset (#11453) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/renderer/src/store/assistants.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/renderer/src/store/assistants.ts b/src/renderer/src/store/assistants.ts index 6fe2832531..4db73a9547 100644 --- a/src/renderer/src/store/assistants.ts +++ b/src/renderer/src/store/assistants.ts @@ -202,11 +202,10 @@ const assistantsSlice = createSlice({ }, updateAssistantPreset: (state, action: PayloadAction) => { 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,