diff --git a/x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/index.tsx b/x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/index.tsx index affb0d4588301..5ae253940568c 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/index.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/index.tsx @@ -184,18 +184,18 @@ const AttackDiscoveryPageComponent: React.FC = () => { const pageTitle = useMemo(() => , []); - const { sourcererDataView } = useSourcererDataView(); + const { indexPattern } = useSourcererDataView(); // filterQuery is the combined search bar query and filters in ES format: const [filterQuery, kqlError] = useMemo( () => convertToBuildEsQuery({ config: getEsQueryConfig(uiSettings), - dataViewSpec: sourcererDataView, + indexPattern, queries: [query ?? getDefaultQuery()], // <-- search bar query filters: filters ?? [], // <-- search bar filters }), - [filters, query, sourcererDataView, uiSettings] + [filters, indexPattern, query, uiSettings] ); // renders a toast if the filter query is invalid: diff --git a/x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/settings_flyout/alert_selection/use_data_view/index.ts b/x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/settings_flyout/alert_selection/use_data_view/index.ts index 829a685c7cc7a..e71fcf57a399d 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/settings_flyout/alert_selection/use_data_view/index.ts +++ b/x-pack/solutions/security/plugins/security_solution/public/attack_discovery/pages/settings_flyout/alert_selection/use_data_view/index.ts @@ -14,7 +14,7 @@ export const useDataView = ({ dataViewSpec, loading, }: { - dataViewSpec: DataViewSpec; + dataViewSpec: DataViewSpec | undefined; loading: boolean; }): DataView | undefined => { const { dataViews } = useKibana().services; @@ -25,7 +25,7 @@ export const useDataView = ({ let active = true; async function createDataView() { - if (!loading) { + if (dataViewSpec != null && !loading) { try { const dv = await dataViews.create(dataViewSpec);