fix: resolve readonly property error in assistant preset settings (#11491)
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user