Ensure step is selected after creation when a new version has to be created (#9218)
Fixes https://discord.com/channels/1130383047699738754/1318606664202715156/1318606664202715156
This commit is contained in:
committed by
GitHub
parent
d2abd59a51
commit
4f329d6005
@ -1,5 +1,6 @@
|
||||
import { getSnapshotValue } from '@/ui/utilities/state/utils/getSnapshotValue';
|
||||
import { workflowDiagramState } from '@/workflow/states/workflowDiagramState';
|
||||
import { workflowLastCreatedStepIdState } from '@/workflow/states/workflowLastCreatedStepIdState';
|
||||
import {
|
||||
WorkflowVersion,
|
||||
WorkflowWithCurrentVersion,
|
||||
@ -39,6 +40,26 @@ export const WorkflowDiagramEffect = ({
|
||||
);
|
||||
}
|
||||
|
||||
const lastCreatedStepId = getSnapshotValue(
|
||||
snapshot,
|
||||
workflowLastCreatedStepIdState,
|
||||
);
|
||||
if (isDefined(lastCreatedStepId)) {
|
||||
mergedWorkflowDiagram.nodes = mergedWorkflowDiagram.nodes.map(
|
||||
(node) => {
|
||||
if (node.id === lastCreatedStepId) {
|
||||
return {
|
||||
...node,
|
||||
selected: true,
|
||||
};
|
||||
}
|
||||
return node;
|
||||
},
|
||||
);
|
||||
|
||||
set(workflowLastCreatedStepIdState, undefined);
|
||||
}
|
||||
|
||||
set(workflowDiagramState, mergedWorkflowDiagram);
|
||||
};
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user