diff --git a/x-pack/plugins/aiops/public/components/change_point_detection/change_point_detection_context.tsx b/x-pack/plugins/aiops/public/components/change_point_detection/change_point_detection_context.tsx index eabfc277b7f9f..75f4820316e30 100644 --- a/x-pack/plugins/aiops/public/components/change_point_detection/change_point_detection_context.tsx +++ b/x-pack/plugins/aiops/public/components/change_point_detection/change_point_detection_context.tsx @@ -132,7 +132,7 @@ export const ChangePointDetectionContextProvider: FC = ({ children }) => { const { uiSettings, data: { - query: { filterManager }, + query: { filterManager, queryString }, }, } = useAiopsAppContext(); @@ -241,11 +241,18 @@ export const ChangePointDetectionContextProvider: FC = ({ children }) => { if (requestParamsFromUrl.filters) { filterManager.setFilters(requestParamsFromUrl.filters); } + if (requestParamsFromUrl.query) { + queryString.setQuery(requestParamsFromUrl.query); + } if (globalFilters) { filterManager?.addFilters(globalFilters); } + return () => { + filterManager?.removeAll(); + queryString.clearQuery(); + }; }, - [requestParamsFromUrl.filters, filterManager] + [requestParamsFromUrl.filters, requestParamsFromUrl.query, filterManager, queryString] ); const combinedQuery = useMemo(() => {