From eb53aa2a1531c7fe2e35bfd8f121f06e08012e6e Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 18:12:15 -0700 Subject: [PATCH] [discover] wait for dataset to created (#8117) (#8120) Cache dataset is an async function that ends up creating the temporary index pattern. The temporary index pattern was not created and was causing an exception so the index pattern was never updated. The index pattern not being updated didn't trigger the hooks to update the other parts of the app. (cherry picked from commit 8ecba3a8f2c3d544b8d0ae9cd416d9e70bbd929e) Signed-off-by: Kawika Avilla Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] --- src/plugins/data/public/ui/dataset_selector/configurator.tsx | 4 ++-- .../public/application/view_components/utils/use_search.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/data/public/ui/dataset_selector/configurator.tsx b/src/plugins/data/public/ui/dataset_selector/configurator.tsx index 4db2419bbbd6..164f677e27a2 100644 --- a/src/plugins/data/public/ui/dataset_selector/configurator.tsx +++ b/src/plugins/data/public/ui/dataset_selector/configurator.tsx @@ -160,8 +160,8 @@ export const Configurator = ({ /> { - queryString.getDatasetService().cacheDataset(dataset); + onClick={async () => { + await queryString.getDatasetService().cacheDataset(dataset); onConfirm(dataset); }} fill diff --git a/src/plugins/discover/public/application/view_components/utils/use_search.ts b/src/plugins/discover/public/application/view_components/utils/use_search.ts index ccb22f86bb29..d0f4fa8d50b5 100644 --- a/src/plugins/discover/public/application/view_components/utils/use_search.ts +++ b/src/plugins/discover/public/application/view_components/utils/use_search.ts @@ -12,7 +12,7 @@ import { cloneDeep } from 'lodash'; import { useLocation } from 'react-router-dom'; import { RequestAdapter } from '../../../../../inspector/public'; import { DiscoverViewServices } from '../../../build_services'; -import { QueryStatus, search } from '../../../../../data/public'; +import { search } from '../../../../../data/public'; import { validateTimeRange } from '../../helpers/validate_time_range'; import { updateSearchSource } from './update_search_source'; import { useIndexPattern } from './use_index_pattern';