diff --git a/v3/src/components/case-table/attribute-menu/attribute-menu-list.tsx b/v3/src/components/case-table/attribute-menu/attribute-menu-list.tsx index eb2cf689a1..a1e9228640 100644 --- a/v3/src/components/case-table/attribute-menu/attribute-menu-list.tsx +++ b/v3/src/components/case-table/attribute-menu/attribute-menu-list.tsx @@ -42,6 +42,13 @@ const AttributeMenuListComp = forwardRef( isClosable: true, }) } + + // can't hide last attribute of collection + const collection = data?.getCollectionForAttribute(columnId) + const visibleAttributes = collection?.attributes + .reduce((sum, attr) => attr && !caseMetadata?.isHidden(attr.id) ? sum + 1 : sum, 0) ?? 0 + const disableHideAttribute = visibleAttributes <= 1 + const handleHideAttribute = () => { caseMetadata?.applyModelChange( () => caseMetadata?.setIsHidden(column.key, true), @@ -136,7 +143,7 @@ const AttributeMenuListComp = forwardRef( handleMenuItemClick("Sort Descending")}> {t("DG.TableController.headerMenuItems.sortDescending")} - + {t("DG.TableController.headerMenuItems.hideAttribute")} handleDeleteAttribute()} isDisabled={disableDeleteAttribute}>