UI: Compare newly selected label with current label to determine if deselecting (#12265)

## Addresses #12251 

https://loom.com/share/1d3e09ad320f4f069316f120014eaf2c

- [x] Manual QA

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
Jacob Shandling 2023-06-09 14:36:37 -04:00 committed by GitHub
parent ed92176194
commit b7acae39bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -498,11 +498,10 @@ const ManageHostsPage = ({
(hostsData?.hosts?.length || 0) >=
hostsCount;
const handleLabelChange = ({ slug }: ILabel): boolean => {
const handleLabelChange = ({ slug, id: newLabelId }: ILabel): boolean => {
const { MANAGE_HOSTS } = PATHS;
const isDeselectingLabel =
labelID && labelID === selectedLabel?.id.toString();
const isDeselectingLabel = newLabelId && newLabelId === selectedLabel?.id;
// Non-status labels are not compatible with policies or software filters
// so omit policies and software params from next location