From b7acae39bb815074982344f80cd0bcab0acd7680 Mon Sep 17 00:00:00 2001 From: Jacob Shandling <61553566+jacobshandling@users.noreply.github.com> Date: Fri, 9 Jun 2023 14:36:37 -0400 Subject: [PATCH] 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 --- frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx b/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx index 0692081584..b8718cd349 100644 --- a/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx +++ b/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx @@ -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