Skip to content

Commit

Permalink
cool way to set array values
Browse files Browse the repository at this point in the history
  • Loading branch information
hughhhh committed Jun 22, 2021
1 parent 55ffd8e commit 9ae61e5
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions superset-frontend/src/views/CRUD/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -674,11 +674,15 @@ export function useDatabaseValidation() {
return { ...obj, [extra.invalid[0]]: message };
}
if (extra.missing) {
const missingFields = {};
extra.missing.map(d => {
missingFields[d] = 'This is a required field';
});
return { ...obj, ...missingFields };
return {
...obj,
...Object.assign(
{},
...extra.missing.map(field => ({
[field]: 'This is a required field',
})),
),
};
}
return obj;
},
Expand Down

0 comments on commit 9ae61e5

Please sign in to comment.