From b8ad252b24a2f7053c7af9abdbf6a2e40880b06e Mon Sep 17 00:00:00 2001 From: Amogh-Bharadwaj Date: Wed, 6 Mar 2024 23:00:40 +0530 Subject: [PATCH] fix textfield states --- ui/app/alert-config/new.tsx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ui/app/alert-config/new.tsx b/ui/app/alert-config/new.tsx index ebc07dba38..53059bbaab 100644 --- a/ui/app/alert-config/new.tsx +++ b/ui/app/alert-config/new.tsx @@ -71,10 +71,10 @@ function getSlackProps( placeholder='Auth Token' value={config.auth_token} onChange={(e) => { - setConfig((value) => { - value.auth_token = e.target.value; - return value; - }); + setConfig((previous) => ({ + ...previous, + auth_token: e.target.value, + })); }} /> @@ -86,10 +86,10 @@ function getSlackProps( placeholder='Comma separated' value={config.channel_ids?.join(',')} onChange={(e) => { - setConfig((value) => { - value.channel_ids = e.target.value.split(','); - return value; - }); + setConfig((previous) => ({ + ...previous, + channel_ids: e.target.value.split(','), + })); }} /> @@ -111,10 +111,10 @@ function getEmailProps( placeholder='Comma separated' value={config.email_addresses?.join(',')} onChange={(e) => { - setConfig((value) => { - value.email_addresses = e.target.value.split(','); - return value; - }); + setConfig((previous) => ({ + ...previous, + email_addresses: e.target.value.split(','), + })); }} />