fix: prevent removing last filter criteria

This commit is contained in:
kasia.oczkowska
2024-08-01 08:40:54 +01:00
parent c1396b97f0
commit e2dbf1a215

View File

@@ -122,7 +122,7 @@ function FilterConditions(props) {
<React.Fragment>
<Stack sx={{ width: '100%' }} direction="column" spacing={2} mt={2}>
{groups?.map((group, groupIndex) => (
<>
<React.Fragment key={groupIndex}>
{groupIndex !== 0 && <Divider />}
<Typography variant="subtitle2" gutterBottom>
@@ -200,6 +200,7 @@ function FilterConditions(props) {
edge="start"
onClick={() => removeGroupItem(groupIndex, groupItemIndex)}
sx={{ width: 61, height: 61 }}
disabled={groups.length === 1 && group.and.length === 1}
>
<RemoveIcon />
</IconButton>
@@ -227,7 +228,7 @@ function FilterConditions(props) {
</IconButton>
)}
</Stack>
</>
</React.Fragment>
))}
</Stack>
</React.Fragment>