Skip to content

Commit

Permalink
[bug] Discover UI stuck on searching after deleting index pattern (op…
Browse files Browse the repository at this point in the history
…ensearch-project#8659) (opensearch-project#8664)

* [bug] Discover UI stuck on searching after deleting index pattern

When using Discover with query enhancement enabled, deleting an index pattern from Index Management does not properly update the "Recently selected data" list in Discover. This causes the UI to become stuck in a "Searching" state when attempting to use
Discover after deleting an index pattern.

Handle the error case where the use index patterns hook caught error when
enhancements was enabled.

issue resolved:
opensearch-project#8612



* Changeset file for PR opensearch-project#8659 created/updated

---------



(cherry picked from commit 4808094)

Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 19, 2024
1 parent 74a69d6 commit bde23d9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/8659.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Discover UI stuck on searching after failing to find deleted index pattern ([#8659](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8659))
Original file line number Diff line number Diff line change
Expand Up @@ -74,25 +74,25 @@ export const useIndexPattern = (services: DiscoverViewServices) => {
handleIndexPattern();
}
} else {
try {
const ip = await fetchIndexPatternDetails(indexPatternIdFromState);
if (isMounted) {
setIndexPattern(ip);
}
} catch (error) {
if (isMounted) {
const warningMessage = i18n.translate('discover.indexPatternFetchErrorWarning', {
defaultMessage: 'Error fetching index pattern: {error}',
values: { error: (error as Error).message },
});
toastNotifications.addWarning(warningMessage);
}
const ip = await fetchIndexPatternDetails(indexPatternIdFromState);
if (isMounted) {
setIndexPattern(ip);
}
}
}
};

handleIndexPattern();
try {
handleIndexPattern();
} catch (error) {
if (isMounted) {
const warningMessage = i18n.translate('discover.indexPatternFetchErrorWarning', {
defaultMessage: 'Error fetching index pattern: {error}',
values: { error: (error as Error).message },
});
toastNotifications.addWarning(warningMessage);
}
}

return () => {
isMounted = false;
Expand Down

0 comments on commit bde23d9

Please sign in to comment.