Skip to content

Commit 3dc905f

Browse files
author
Jimmy Choi
committed
wrap in try/catch
1 parent fc2a4c6 commit 3dc905f

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

packages/compass-indexes/src/components/indexes-toolbar/indexes-toolbar.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@ const createIndexButtonContainerStyles = css({
5454
width: 'fit-content',
5555
});
5656

57+
const MIN_SEARCH_INDEX_MANAGEMENT_SERVER_VERSION = '6.0.7';
58+
59+
const serverSupportsSearchIndexManagement = (serverVersion: string) => {
60+
try {
61+
return semver.gte(
62+
serverVersion,
63+
MIN_SEARCH_INDEX_MANAGEMENT_SERVER_VERSION
64+
);
65+
} catch {
66+
return true;
67+
}
68+
};
69+
5770
type IndexesToolbarProps = {
5871
namespace: string;
5972
indexView: IndexView;
@@ -191,7 +204,7 @@ export const IndexesToolbar: React.FunctionComponent<IndexesToolbarProps> = ({
191204
</SegmentedControlOption>
192205
}
193206
>
194-
{semver.gte(serverVersion, '6.0.7') ? (
207+
{serverSupportsSearchIndexManagement(serverVersion) ? (
195208
<p>
196209
Unable to fetch search indexes. This can occur when your
197210
cluster does not support search indexes or the listing

0 commit comments

Comments
 (0)