From 5aaa00cf9b314784a706cac6caae808018ddf4dc Mon Sep 17 00:00:00 2001 From: Hailong Cui Date: Tue, 10 Sep 2024 09:15:59 +0800 Subject: [PATCH] [Discover]Fix infinite loop cause discover hang (#8082) * fix infinit loop cause discovery hang Signed-off-by: Hailong Cui * Changeset file for PR #8082 created/updated --------- Signed-off-by: Hailong Cui Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> --- changelogs/fragments/8082.yml | 2 ++ .../application/view_components/utils/use_index_pattern.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/8082.yml 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(); }