18116: Chips guard against invariant bug
authorStephen Smith <stephen@curii.com>
Tue, 21 Sep 2021 20:29:24 +0000 (16:29 -0400)
committerStephen Smith <stephen@curii.com>
Tue, 21 Sep 2021 20:29:24 +0000 (16:29 -0400)
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen@curii.com>

src/components/chips/chips.tsx

index 2a6fafc3991e415ff38e52095f2a518deb540b62..eb68ed7a257942a6fb554f80b544089d93fcaa43 100644 (file)
@@ -43,10 +43,13 @@ export const Chips = withStyles(styles)(
             </Grid>;
         }
 
-        renderChip = (value: Value, index: number) =>
-            <Grid item key={index}>
-                <this.chip {...{ value }} />
+        renderChip = (value: Value, index: number) => {
+            const { deletable, getLabel } = this.props;
+            return <Grid item key={index}>
+                <Chip onDelete={deletable ? this.deleteValue(value) : undefined}
+                    label={getLabel !== undefined ? getLabel(value) : value} />
             </Grid>
+        }
 
         type = 'chip';
 
@@ -132,4 +135,4 @@ interface CollectedProps {
 
 interface DraggableChipProps<Value> {
     value: Value;
-}
\ No newline at end of file
+}