diff --git a/changelogs/fragments/8082.yml b/changelogs/fragments/8082.yml new file mode 100644 index 000000000000..e360fdb9d3fc --- /dev/null +++ b/changelogs/fragments/8082.yml @@ -0,0 +1,2 @@ +fix: +- [Discover]Fix infinite loop cause discover hang ([#8082](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8082)) \ No newline at end of file diff --git a/src/plugins/discover/public/application/view_components/utils/use_index_pattern.ts b/src/plugins/discover/public/application/view_components/utils/use_index_pattern.ts index 2f8bd6fbebf6..c9585240da70 100644 --- a/src/plugins/discover/public/application/view_components/utils/use_index_pattern.ts +++ b/src/plugins/discover/public/application/view_components/utils/use_index_pattern.ts @@ -59,7 +59,7 @@ export const useIndexPattern = (services: DiscoverViewServices) => { indexPatternList || [], uiSettings.get('defaultIndex') ); - if (isMounted) { + if (isMounted && newId) { store!.dispatch(updateIndexPattern(newId)); handleIndexPattern(); }