From a2f67dddb6ed64646101fd7e10abbfdb9edb8ce0 Mon Sep 17 00:00:00 2001 From: MyPrototypeWhat Date: Thu, 27 Nov 2025 13:41:33 +0800 Subject: [PATCH] fix: resolve readonly property error in assistant preset settings (#11491) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When updating assistant preset settings, if agent.settings was undefined, it was assigned the DEFAULT_ASSISTANT_SETTINGS object directly. Since this object is defined with `as const`, it is readonly and subsequent property assignments would fail with "Cannot assign to read only property". Fixed by creating a shallow copy of DEFAULT_ASSISTANT_SETTINGS instead of referencing it directly. Closes #11490 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude --- src/renderer/src/store/assistants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/src/store/assistants.ts b/src/renderer/src/store/assistants.ts index 4db73a9547..51638be9f6 100644 --- a/src/renderer/src/store/assistants.ts +++ b/src/renderer/src/store/assistants.ts @@ -216,7 +216,7 @@ const assistantsSlice = createSlice({ if (agent.id === action.payload.assistantId) { for (const key in settings) { if (!agent.settings) { - agent.settings = DEFAULT_ASSISTANT_SETTINGS + agent.settings = { ...DEFAULT_ASSISTANT_SETTINGS } } agent.settings[key] = settings[key] }