From 4929e29fffc922c6695618efb0a25030c1f6f03e Mon Sep 17 00:00:00 2001 From: Amogh-Bharadwaj Date: Tue, 7 Nov 2023 09:45:22 -0500 Subject: [PATCH] handle new rows better --- ui/app/mirrors/create/tablemapping.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/app/mirrors/create/tablemapping.tsx b/ui/app/mirrors/create/tablemapping.tsx index 95d501c960..65a77a8d8b 100644 --- a/ui/app/mirrors/create/tablemapping.tsx +++ b/ui/app/mirrors/create/tablemapping.tsx @@ -42,14 +42,14 @@ const TableMapping = ({ const handleAddRow = (source: string) => { const newRows = [...rows]; const index = newRows.findIndex((row) => row.source === source); - if (index >= 0) newRows[index].selected = true; + if (index >= 0) newRows[index] = { ...newRows[index], selected: true }; setRows(newRows); }; const handleRemoveRow = (source: string) => { const newRows = [...rows]; const index = newRows.findIndex((row) => row.source === source); - if (index >= 0) newRows[index].selected = false; + if (index >= 0) newRows[index] = { ...newRows[index], selected: false }; setRows(newRows); }; @@ -75,15 +75,15 @@ const TableMapping = ({ // find the row with source and update the destination const newRows = [...rows]; const index = newRows.findIndex((row) => row.source === source); - newRows[index].destination = dest; - return newRows; + newRows[index] = { ...newRows[index], destination: dest }; + setRows(newRows); }; const updatePartitionKey = (source: string, pkey: string) => { const newRows = [...rows]; const index = newRows.findIndex((row) => row.source === source); - newRows[index].partitionKey = pkey; - return newRows; + newRows[index] = { ...newRows[index], partitionKey: pkey }; + setRows(newRows); }; const getTablesOfSchema = useCallback(