From 9ae61e5b19c68f9a8d592f72045fb02b5f621e37 Mon Sep 17 00:00:00 2001 From: hughhhh Date: Tue, 22 Jun 2021 18:02:07 -0400 Subject: [PATCH] cool way to set array values --- superset-frontend/src/views/CRUD/hooks.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/superset-frontend/src/views/CRUD/hooks.ts b/superset-frontend/src/views/CRUD/hooks.ts index 4e2ba19da94a6..bd8e19cde1bd8 100644 --- a/superset-frontend/src/views/CRUD/hooks.ts +++ b/superset-frontend/src/views/CRUD/hooks.ts @@ -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; },