@@ -155,23 +155,26 @@ export function AnomalyDetectionOverview(props: AnomalyDetectionOverviewProps) {
155
155
156
156
// fetch smaple detectors and sample indices
157
157
const fetchData = async ( ) => {
158
- await dispatch (
159
- getDetectorList (
160
- getSampleDetectorsQueryParamsWithDataSouceId (
158
+ // wait until selected data source is ready before doing dispatch calls if mds is enabled
159
+ if ( ! dataSourceEnabled || ( MDSOverviewState . selectedDataSourceId && MDSOverviewState . selectedDataSourceId !== "" ) ) {
160
+ await dispatch (
161
+ getDetectorList (
162
+ getSampleDetectorsQueryParamsWithDataSouceId (
163
+ MDSOverviewState . selectedDataSourceId
164
+ )
165
+ )
166
+ ) . catch ( ( error : any ) => {
167
+ console . error ( 'Error getting sample detectors: ' , error ) ;
168
+ } ) ;
169
+ await dispatch (
170
+ getIndices (
171
+ GET_SAMPLE_INDICES_QUERY ,
161
172
MDSOverviewState . selectedDataSourceId
162
173
)
163
- )
164
- ) . catch ( ( error : any ) => {
165
- console . error ( 'Error getting sample detectors: ' , error ) ;
166
- } ) ;
167
- await dispatch (
168
- getIndices (
169
- GET_SAMPLE_INDICES_QUERY ,
170
- MDSOverviewState . selectedDataSourceId
171
- )
172
- ) . catch ( ( error : any ) => {
173
- console . error ( 'Error getting sample indices: ' , error ) ;
174
- } ) ;
174
+ ) . catch ( ( error : any ) => {
175
+ console . error ( 'Error getting sample indices: ' , error ) ;
176
+ } ) ;
177
+ }
175
178
} ;
176
179
177
180
// Create and populate sample index, create and start sample detector
0 commit comments