diff --git a/src/components/GroupSystems/GroupSystems.js b/src/components/GroupSystems/GroupSystems.js index 905714306..eb288b6f1 100644 --- a/src/components/GroupSystems/GroupSystems.js +++ b/src/components/GroupSystems/GroupSystems.js @@ -141,7 +141,7 @@ const GroupSystems = ({ groupName, groupId }) => { hostGroupFilter, lastSeenFilter ); - }, []); + }, [addToGroupModalOpen]); const bulkSelectConfig = useBulkSelectConfig( selected, diff --git a/src/components/InventoryGroups/Modals/AddSystemsToGroupModal.js b/src/components/InventoryGroups/Modals/AddSystemsToGroupModal.js index 494ff874a..f339a954d 100644 --- a/src/components/InventoryGroups/Modals/AddSystemsToGroupModal.js +++ b/src/components/InventoryGroups/Modals/AddSystemsToGroupModal.js @@ -104,14 +104,14 @@ const AddSystemsToGroupModal = ({ [isModalOpen] ); - const calculateSelected = () => (selected ? selected.size : 0); + const numOfSelectedSystems = selected ? selected.size : 0; const handleModalClose = () => { - setIsModalOpen(false); - if (calculateSelected() > 0) { + if (numOfSelectedSystems > 0) { dispatch(selectEntity(-1, false)); } dispatch(clearFilters()); + setIsModalOpen(false); }; const edgeParityInventoryListEnabled = useFeatureFlag( @@ -190,7 +190,7 @@ const AddSystemsToGroupModal = ({ setConfirmationModalOpen(false); setSystemSelectModalOpen(true); // switch back to the systems table modal }} - onCancel={() => handleModalClose()} + onCancel={handleModalClose} hostsNumber={alreadyHasGroup.length} /> {/** hosts selection modal */} @@ -214,7 +214,7 @@ const AddSystemsToGroupModal = ({ } isOpen={systemsSelectModalOpen} - onClose={() => handleModalClose()} + onClose={handleModalClose} footer={ {showWarning && ( @@ -244,11 +244,7 @@ const AddSystemsToGroupModal = ({ > Add systems -