diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitors_page/common/show_all_spaces.tsx b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitors_page/common/show_all_spaces.tsx index 83016330ae507..9f1d632ede7d1 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitors_page/common/show_all_spaces.tsx +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitors_page/common/show_all_spaces.tsx @@ -43,7 +43,7 @@ export const ShowAllSpaces: React.FC = () => { }; const SelectablePopover = () => { - const [isPopoverOpen, setPopover] = useState(false); + const [isPopoverOpen, setIsPopoverOpen] = useState(false); const { space } = useKibanaSpace(); const { @@ -51,19 +51,12 @@ const SelectablePopover = () => { } = useSelector(selectOverviewState); const dispatch = useDispatch(); - const onButtonClick = () => { - setPopover(!isPopoverOpen); - }; - const closePopover = () => { - setPopover(false); - }; - const button = ( setIsPopoverOpen(!isPopoverOpen)} size="xs" > {showFromAllSpaces ? ALL_SPACES_LABEL : space?.name || space?.id} @@ -74,7 +67,7 @@ const SelectablePopover = () => { id="contextMenuSpaces" button={button} isOpen={isPopoverOpen} - closePopover={closePopover} + closePopover={() => setIsPopoverOpen(false)} panelPaddingSize="none" anchorPosition="downLeft" >