Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
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 @@
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);

Check warning on line 77 in src/plugins/discover/public/application/view_components/utils/use_index_pattern.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/discover/public/application/view_components/utils/use_index_pattern.ts#L77

Added line #L77 was not covered by tests
if (isMounted) {
setIndexPattern(ip);

Check warning on line 79 in src/plugins/discover/public/application/view_components/utils/use_index_pattern.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/discover/public/application/view_components/utils/use_index_pattern.ts#L79

Added line #L79 was not covered by tests
}
}
}
};

handleIndexPattern();
try {
handleIndexPattern();

Check warning on line 86 in src/plugins/discover/public/application/view_components/utils/use_index_pattern.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/discover/public/application/view_components/utils/use_index_pattern.ts#L85-L86

Added lines #L85 - L86 were not covered by tests
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', {

Check warning on line 89 in src/plugins/discover/public/application/view_components/utils/use_index_pattern.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/discover/public/application/view_components/utils/use_index_pattern.ts#L89

Added line #L89 was not covered by tests
defaultMessage: 'Error fetching index pattern: {error}',
values: { error: (error as Error).message },
});
toastNotifications.addWarning(warningMessage);

Check warning on line 93 in src/plugins/discover/public/application/view_components/utils/use_index_pattern.ts

View check run for this annotation

Codecov / codecov/patch

src/plugins/discover/public/application/view_components/utils/use_index_pattern.ts#L93

Added line #L93 was not covered by tests
}
}

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