18257: Adds checks to array values thay may be null or undefined. 18257-chips-error-fix
authorLucas Di Pentima <lucas.dipentima@curii.com>
Wed, 1 Dec 2021 19:18:42 +0000 (16:18 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Wed, 1 Dec 2021 19:18:42 +0000 (16:18 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

src/components/chips/chips.tsx
src/views/run-process-panel/inputs/float-array-input.tsx
src/views/run-process-panel/inputs/int-array-input.tsx
src/views/run-process-panel/inputs/string-array-input.tsx

index eb68ed7a257942a6fb554f80b544089d93fcaa43..c4724d1bb1a8d9b0ffcb3c79b6127c1a1fddd6c1 100644 (file)
@@ -38,7 +38,7 @@ export const Chips = withStyles(styles)(
         render() {
             const { values, filler } = this.props;
             return <Grid container spacing={8} className={this.props.classes.root}>
-                {values.map(this.renderChip)}
+                {values && values.map(this.renderChip)}
                 {filler && <Grid item xs>{filler}</Grid>}
             </Grid>;
         }
index 780cbc90fedc7e8a45e93b798fd3843c433a3d6d..3f0a5334fa468c2deba7095435937bd0e2ef3bac 100644 (file)
@@ -30,7 +30,7 @@ const validationSelector = createSelector(
 );
 
 const required = (value: string[]) =>
-    value.length > 0
+    value && value.length > 0
         ? undefined
         : ERROR_MESSAGE;
 
index 03cb07ea3e1368ec3829e502a2b26376356471f0..8077f28a600342cf95b3e77cf0980a17a4b30d0c 100644 (file)
@@ -30,7 +30,7 @@ const validationSelector = createSelector(
 );
 
 const required = (value: string[]) =>
-    value.length > 0
+    value && value.length > 0
         ? undefined
         : ERROR_MESSAGE;
 
index cabbf749816fa844f4293418daa7298a176f2686..8955009a0d52984a9393b675e9721825f4a746d0 100644 (file)
@@ -31,7 +31,7 @@ const validationSelector = createSelector(
 );
 
 const required = (value: string[] = []) =>
-    value.length > 0
+    value && value.length > 0
         ? undefined
         : ERROR_MESSAGE;