From dc7bcdbab6c83478a1ade63737405add5032e542 Mon Sep 17 00:00:00 2001 From: Dominique Clarke Date: Fri, 5 May 2023 04:21:42 -0400 Subject: [PATCH] [Synthetics] refresh data on visualization scrubbing (#156777) Co-authored-by: Shahzad (cherry picked from commit 29fe83f06a34f092a4533700e5ebaba1fca4dc80) --- .../components/monitor_details/monitor_pending_wrapper.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/monitor_details/monitor_pending_wrapper.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/components/monitor_details/monitor_pending_wrapper.tsx index 7ff27c67384e1..20658b38c6c54 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/components/monitor_details/monitor_pending_wrapper.tsx +++ b/x-pack/plugins/synthetics/public/apps/synthetics/components/monitor_details/monitor_pending_wrapper.tsx @@ -13,6 +13,7 @@ import { EuiLoadingSpinner, EuiLoadingChart } from '@elastic/eui'; import { PageLoader } from '../common/components/page_loader'; import { resetMonitorLastRunAction } from '../../state'; import { useMonitorLatestPing } from './hooks/use_monitor_latest_ping'; +import { useSyntheticsRefreshContext } from '../../contexts'; export const MonitorPendingWrapper: React.FC = ({ children }) => { const dispatch = useDispatch(); @@ -20,6 +21,7 @@ export const MonitorPendingWrapper: React.FC = ({ children }) => { const currentLocation = useLocation(); const locationRef = useRef(currentLocation); const { monitorId } = useParams<{ monitorId: string }>(); + const { refreshApp } = useSyntheticsRefreshContext(); const { latestPing, loaded: pingsLoaded } = useMonitorLatestPing(); const [loaded, setLoaded] = useState(false); @@ -36,9 +38,10 @@ export const MonitorPendingWrapper: React.FC = ({ children }) => { setLoaded(false); setHasPing(false); dispatch(resetMonitorLastRunAction()); + refreshApp(); } }), - [history, monitorId, dispatch] + [history, monitorId, dispatch, refreshApp] ); useEffect(() => {