From ebc9ccbe1cd08b517ee85efb25f606eb528bd252 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 1 Apr 2026 04:51:51 -0500 Subject: [PATCH] refac --- .../MessageInput/InputVariablesModal.svelte | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/lib/components/chat/MessageInput/InputVariablesModal.svelte b/src/lib/components/chat/MessageInput/InputVariablesModal.svelte index e75e2d18c1..e812312336 100644 --- a/src/lib/components/chat/MessageInput/InputVariablesModal.svelte +++ b/src/lib/components/chat/MessageInput/InputVariablesModal.svelte @@ -22,12 +22,16 @@ const submitHandler = async () => { // Normalize Windows CRLF (\r\n) to LF (\n) for all string values + // Build a new object to avoid mutating the reactive variableValues proxy + const result = {}; for (const key of Object.keys(variableValues)) { if (typeof variableValues[key] === 'string') { - variableValues[key] = variableValues[key].replace(/\r\n/g, '\n'); + result[key] = variableValues[key].replace(/\r\n/g, '\n'); + } else { + result[key] = variableValues[key]; } } - onSave(variableValues); + onSave(result); show = false; }; @@ -102,20 +106,17 @@
{#if variables[variable]?.type === 'select'} - {@const options = variableAttributes?.options ?? []} - {@const placeholder = variableAttributes?.placeholder ?? ''} -