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

[Backport 2.x] Fix MDS bug #531

Merged
merged 1 commit into from
Dec 13, 2024
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
54 changes: 33 additions & 21 deletions public/pages/workflows/workflows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ export function Workflows(props: WorkflowsProps) {
escape(tabFromUrl) as WORKFLOWS_TAB
);

const isDataSourceReady =
!dataSourceEnabled || (dataSourceId && dataSourceId !== '');

// If there is no selected tab or invalid tab, default to manage tab
useEffect(() => {
if (
Expand All @@ -116,14 +119,17 @@ 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 (isDataSourceReady) {
dispatch(
searchWorkflows({
apiBody: FETCH_ALL_QUERY,
dataSourceId: dataSourceId,
})
);
}
}
}, [selectedTabId]);
}, [selectedTabId, dataSourceId, dataSourceEnabled]);

useEffect(() => {
setBreadcrumbs(
Expand All @@ -138,13 +144,16 @@ 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 (isDataSourceReady) {
dispatch(
searchWorkflows({
apiBody: FETCH_ALL_QUERY,
dataSourceId: dataSourceId,
})
);
}
}, [dataSourceId, dataSourceEnabled]);

useEffect(() => {
const { history, location } = props;
Expand All @@ -158,13 +167,16 @@ export function Workflows(props: WorkflowsProps) {
search: queryString.stringify(updatedParams),
});
}
dispatch(
searchWorkflows({
apiBody: FETCH_ALL_QUERY,
dataSourceId: dataSourceId,
})
);
}, [dataSourceId, setDataSourceId]);
// wait until selected data source is ready before doing dispatch calls if mds is enabled
if (isDataSourceReady) {
dispatch(
searchWorkflows({
apiBody: FETCH_ALL_QUERY,
dataSourceId: dataSourceId,
})
);
}
}, [dataSourceId, setDataSourceId, dataSourceEnabled]);

const handleDataSourceChange = ([event]: DataSourceOption[]) => {
const dataSourceEventId = event?.id;
Expand Down
Loading