Skip to content

Commit

Permalink
handle new rows better
Browse files Browse the repository at this point in the history
  • Loading branch information
Amogh-Bharadwaj committed Nov 7, 2023
1 parent 72ea432 commit 4929e29
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ui/app/mirrors/create/tablemapping.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand All @@ -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(
Expand Down

0 comments on commit 4929e29

Please sign in to comment.