Reset step output schema when step is removed (#10762)
When a step is deleted in a draft version, its variable are still available in the following steps. This is because step output schema was not reset. We needed either to refresh or to change version so output schema gets updated. This PR: - migrates to a family state global + context not linked to a component - add a reset step output schema function - reset when a step is removed
This commit is contained in:
@ -2,7 +2,7 @@ import { workflowIdComponentState } from '@/command-menu/pages/workflow/states/w
|
||||
import { CommandMenuWorkflowEditStepContent } from '@/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepContent';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
|
||||
import { WorkflowVersionComponentInstanceContext } from '@/workflow/states/context/WorkflowVersionComponentInstanceContext';
|
||||
import { WorkflowStepContextProvider } from '@/workflow/states/context/WorkflowStepContext';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
export const CommandMenuWorkflowEditStep = () => {
|
||||
@ -14,10 +14,10 @@ export const CommandMenuWorkflowEditStep = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<WorkflowVersionComponentInstanceContext.Provider
|
||||
value={{ instanceId: workflow.currentVersion.id }}
|
||||
<WorkflowStepContextProvider
|
||||
value={{ workflowVersionId: workflow.currentVersion.id }}
|
||||
>
|
||||
<CommandMenuWorkflowEditStepContent workflow={workflow} />
|
||||
</WorkflowVersionComponentInstanceContext.Provider>
|
||||
</WorkflowStepContextProvider>
|
||||
);
|
||||
};
|
||||
|
||||
@ -4,7 +4,7 @@ import { useTabList } from '@/ui/layout/tab/hooks/useTabList';
|
||||
import { useFlowOrThrow } from '@/workflow/hooks/useFlowOrThrow';
|
||||
import { useWorkflowRun } from '@/workflow/hooks/useWorkflowRun';
|
||||
import { useWorkflowRunIdOrThrow } from '@/workflow/hooks/useWorkflowRunIdOrThrow';
|
||||
import { WorkflowVersionComponentInstanceContext } from '@/workflow/states/context/WorkflowVersionComponentInstanceContext';
|
||||
import { WorkflowStepContextProvider } from '@/workflow/states/context/WorkflowStepContext';
|
||||
import { useWorkflowSelectedNodeOrThrow } from '@/workflow/workflow-diagram/hooks/useWorkflowSelectedNodeOrThrow';
|
||||
import { WorkflowRunStepInputDetail } from '@/workflow/workflow-steps/components/WorkflowRunStepInputDetail';
|
||||
import { WorkflowRunStepOutputDetail } from '@/workflow/workflow-steps/components/WorkflowRunStepOutputDetail';
|
||||
@ -66,8 +66,8 @@ export const CommandMenuWorkflowRunViewStep = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<WorkflowVersionComponentInstanceContext.Provider
|
||||
value={{ instanceId: workflowRun.workflowVersionId }}
|
||||
<WorkflowStepContextProvider
|
||||
value={{ workflowVersionId: workflowRun.workflowVersionId }}
|
||||
>
|
||||
<StyledTabListContainer>
|
||||
<TabList
|
||||
@ -93,6 +93,6 @@ export const CommandMenuWorkflowRunViewStep = () => {
|
||||
{activeTabId === 'output' ? (
|
||||
<WorkflowRunStepOutputDetail stepId={workflowSelectedNode} />
|
||||
) : null}
|
||||
</WorkflowVersionComponentInstanceContext.Provider>
|
||||
</WorkflowStepContextProvider>
|
||||
);
|
||||
};
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useFlowOrThrow } from '@/workflow/hooks/useFlowOrThrow';
|
||||
import { WorkflowVersionComponentInstanceContext } from '@/workflow/states/context/WorkflowVersionComponentInstanceContext';
|
||||
import { WorkflowStepContextProvider } from '@/workflow/states/context/WorkflowStepContext';
|
||||
import { useWorkflowSelectedNodeOrThrow } from '@/workflow/workflow-diagram/hooks/useWorkflowSelectedNodeOrThrow';
|
||||
import { WorkflowStepDetail } from '@/workflow/workflow-steps/components/WorkflowStepDetail';
|
||||
|
||||
@ -7,8 +7,8 @@ export const CommandMenuWorkflowViewStep = () => {
|
||||
const flow = useFlowOrThrow();
|
||||
const workflowSelectedNode = useWorkflowSelectedNodeOrThrow();
|
||||
return (
|
||||
<WorkflowVersionComponentInstanceContext.Provider
|
||||
value={{ instanceId: flow.workflowVersionId }}
|
||||
<WorkflowStepContextProvider
|
||||
value={{ workflowVersionId: flow.workflowVersionId }}
|
||||
>
|
||||
<WorkflowStepDetail
|
||||
stepId={workflowSelectedNode}
|
||||
@ -16,6 +16,6 @@ export const CommandMenuWorkflowViewStep = () => {
|
||||
steps={flow.steps}
|
||||
readonly
|
||||
/>
|
||||
</WorkflowVersionComponentInstanceContext.Provider>
|
||||
</WorkflowStepContextProvider>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user