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

Wait for detector to load before checking indices exist #262

Merged
merged 1 commit into from
May 17, 2022
Merged
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
7 changes: 5 additions & 2 deletions public/pages/DetectorDetail/containers/DetectorDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ export const DetectorDetail = (props: DetectorDetailProps) => {
core.notifications.toasts.addDanger('Error getting all indices');
});
};
getInitialIndices();
// only need to check if indices exist after detector finishes loading
if (!isLoadingDetector) {
getInitialIndices();
}
}, [detector]);

useEffect(() => {
Expand All @@ -188,7 +191,7 @@ export const DetectorDetail = (props: DetectorDetailProps) => {
// If the detector state was changed after opening the stop detector modal,
// re-check if any jobs are running, and close the modal if it's not needed anymore
useEffect(() => {
if (!isRTJobRunning && !isHistoricalJobRunning) {
if (!isRTJobRunning && !isHistoricalJobRunning && !isEmpty(detector)) {
hideStopDetectorModal();
}
}, [detector]);
Expand Down