diff --git a/public/pages/workflows/workflows.tsx b/public/pages/workflows/workflows.tsx index 90a6f857..71958aec 100644 --- a/public/pages/workflows/workflows.tsx +++ b/public/pages/workflows/workflows.tsx @@ -116,12 +116,15 @@ export function Workflows(props: WorkflowsProps) { // If the user navigates back to the manage tab, re-fetch workflows useEffect(() => { if (selectedTabId === WORKFLOWS_TAB.MANAGE) { - dispatch( - searchWorkflows({ - apiBody: FETCH_ALL_QUERY, - dataSourceId: dataSourceId, - }) - ); + // wait until selected data source is ready before doing dispatch calls if mds is enabled + if (!dataSourceEnabled || (dataSourceId && dataSourceId !== '')) { + dispatch( + searchWorkflows({ + apiBody: FETCH_ALL_QUERY, + dataSourceId: dataSourceId, + }) + ); + } } }, [selectedTabId]); @@ -138,12 +141,15 @@ export function Workflows(props: WorkflowsProps) { // On initial render: fetch all workflows useEffect(() => { - dispatch( - searchWorkflows({ - apiBody: FETCH_ALL_QUERY, - dataSourceId: dataSourceId, - }) - ); + // wait until selected data source is ready before doing dispatch calls if mds is enabled + if (!dataSourceEnabled || (dataSourceId && dataSourceId !== '')) { + dispatch( + searchWorkflows({ + apiBody: FETCH_ALL_QUERY, + dataSourceId: dataSourceId, + }) + ); + } }, []); useEffect(() => { @@ -158,12 +164,15 @@ export function Workflows(props: WorkflowsProps) { search: queryString.stringify(updatedParams), }); } - dispatch( - searchWorkflows({ - apiBody: FETCH_ALL_QUERY, - dataSourceId: dataSourceId, - }) - ); + // wait until selected data source is ready before doing dispatch calls if mds is enabled + if (!dataSourceEnabled || (dataSourceId && dataSourceId !== '')) { + dispatch( + searchWorkflows({ + apiBody: FETCH_ALL_QUERY, + dataSourceId: dataSourceId, + }) + ); + } }, [dataSourceId, setDataSourceId]); const handleDataSourceChange = ([event]: DataSourceOption[]) => {