Skip to content

Commit

Permalink
Follow up review
Browse files Browse the repository at this point in the history
  • Loading branch information
stratoula committed Oct 22, 2024
1 parent f806040 commit a6da3da
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import React, { useCallback, useEffect, useState } from 'react';
import { i18n } from '@kbn/i18n';
import useAsync from 'react-use/lib/useAsync';
import useMountedState from 'react-use/lib/useMountedState';
import { v4 as uuidv4 } from 'uuid';
import {
getESQLAdHocDataview,
Expand Down Expand Up @@ -52,7 +51,6 @@ export const DashboardAppNoDataPage = ({
share: shareService,
};
const [abortController, setAbortController] = useState(new AbortController());
const isMounted = useMountedState();
const importPromise = import('@kbn/shared-ux-page-analytics-no-data');
const AnalyticsNoDataPageKibanaProvider = withSuspense(
React.lazy(() =>
Expand All @@ -74,7 +72,7 @@ export const DashboardAppNoDataPage = ({

const onTryESQL = useCallback(async () => {
abortController?.abort();
if (lensHelpersAsync.value && isMounted()) {
if (lensHelpersAsync.value) {
const abc = new AbortController();
const { dataViews } = dataService;
const indexName = (await getIndexForESQLQuery({ dataViews })) ?? '*';
Expand Down Expand Up @@ -126,15 +124,17 @@ export const DashboardAppNoDataPage = ({
});
}
} catch (error) {
coreServices.notifications.toasts.addWarning(
i18n.translate('dashboard.noDataviews.esqlRequestWarningMessage', {
defaultMessage: 'Unable to load columns. {errorMessage}',
values: { errorMessage: error.message },
})
);
if (error.name !== 'AbortError') {
coreServices.notifications.toasts.addWarning(
i18n.translate('dashboard.noDataviews.esqlRequestWarningMessage', {
defaultMessage: 'Unable to load columns. {errorMessage}',
values: { errorMessage: error.message },
})
);
}
}
}
}, [abortController, isMounted, lensHelpersAsync.value]);
}, [abortController, lensHelpersAsync.value]);

const AnalyticsNoDataPage = withSuspense(
React.lazy(() =>
Expand Down

0 comments on commit a6da3da

Please sign in to comment.