Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so instead of just handling the error case when enhancements is in not enabled. i wrapped the function in the same try catch. so in reality the delta change here was just moving where we put the try catch on

} 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