feat(csv-import): fix invalid columnKey select

This commit is contained in:
Han Tuerker
2022-08-18 09:55:09 +03:00
parent f7e2161165
commit 086fd66dad

View File

@@ -119,7 +119,7 @@ export default function Step1Columns({
const handleChange = (csvKey: string) => (value: string) => {
const columnKey = !!tableSchema.columns?.[value] ? value : camelCase(value);
if (columnKey === "") return;
// Check if this pair already exists in config
const configIndex = findIndex(config.pairs, { csvKey });
if (configIndex > -1) {
@@ -334,7 +334,7 @@ export default function Step1Columns({
<TextField
disabled={config.documentId !== "column"}
select
value={config.documentIdCsvKey}
value={config.documentIdCsvKey ?? ""}
onChange={(e) =>
setConfig((prev) => ({
...prev,
@@ -369,8 +369,8 @@ export default function Step1Columns({
</FormControl>
</Grid>
<Grid item xs={12}>
{stepErrors().map((error) => (
<Alert severity="error" sx={{ my: 1 }}>
{stepErrors().map((error, index) => (
<Alert key={index} severity="error" sx={{ my: 1 }}>
<AlertTitle>{error}</AlertTitle>
</Alert>
))}