Merge pull request #21084 from iwarra/fix-broken-table-filter

Bug fix concerning the issue #20971
This commit is contained in:
Patrik Oldsberg
2023-11-14 12:28:12 +01:00
committed by GitHub
2 changed files with 19 additions and 9 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core-components': patch
---
Fixed an issue causing the `Select` component to show empty chips when some of the selected values did not match any item
@@ -218,15 +218,20 @@ export function SelectComponent(props: SelectProps) {
renderValue={s =>
multiple && (value as any[]).length !== 0 ? (
<Box className={classes.chips}>
{(s as string[]).map(selectedValue => (
<Chip
key={items.find(el => el.value === selectedValue)?.value}
label={items.find(el => el.value === selectedValue)?.label}
clickable
onDelete={handleDelete(selectedValue)}
className={classes.chip}
/>
))}
{(s as string[]).map(selectedValue => {
const item = items.find(el => el.value === selectedValue);
return item ? (
<Chip
key={item?.value}
label={item?.label}
clickable
onDelete={handleDelete(selectedValue)}
className={classes.chip}
/>
) : (
false
);
})}
</Box>
) : (
<Typography>