Bug fixes batch (#18457)
Fixes https://github.com/twentyhq/twenty/issues/18181 Fixes https://github.com/twentyhq/twenty/issues/16842 Iterators remain running, which prevent the stopping state to eventually become stopped Fixes https://github.com/twentyhq/twenty/issues/18186
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
||||
import {
|
||||
StepStatus,
|
||||
type WorkflowRunStepInfo,
|
||||
type WorkflowRunStepInfos,
|
||||
} from 'twenty-shared/workflow';
|
||||
|
||||
import { isWorkflowIteratorAction } from 'src/modules/workflow/workflow-executor/workflow-actions/iterator/guards/is-workflow-iterator-action.guard';
|
||||
import { type WorkflowAction } from 'src/modules/workflow/workflow-executor/workflow-actions/types/workflow-action.type';
|
||||
|
||||
export const setAllIteratorsStepInfosAsStopped = ({
|
||||
stepInfos,
|
||||
steps,
|
||||
}: {
|
||||
stepInfos: WorkflowRunStepInfos;
|
||||
steps: WorkflowAction[];
|
||||
}): Record<string, WorkflowRunStepInfo> => {
|
||||
const stoppedStepInfos: Record<string, WorkflowRunStepInfo> = {};
|
||||
|
||||
for (const step of steps) {
|
||||
if (
|
||||
stepInfos[step.id]?.status === StepStatus.RUNNING &&
|
||||
isWorkflowIteratorAction(step)
|
||||
) {
|
||||
stoppedStepInfos[step.id] = {
|
||||
...stepInfos[step.id],
|
||||
status: StepStatus.STOPPED,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return stoppedStepInfos;
|
||||
};
|
||||
Reference in New Issue
Block a user