feat(Editor): toggle next step upon continuing

This commit is contained in:
Ali BARIN
2022-09-27 21:52:49 +02:00
parent 330902ccb3
commit fca140e3c9
4 changed files with 23 additions and 8 deletions

View File

@@ -21,6 +21,7 @@ type TestSubstepProps = {
onCollapse: () => void;
onChange?: ({ step }: { step: IStep }) => void;
onSubmit?: () => void;
onContinue?: () => void;
step: IStep;
};
@@ -31,6 +32,7 @@ function TestSubstep(props: TestSubstepProps): React.ReactElement {
onExpand,
onCollapse,
onSubmit,
onContinue,
step,
} = props;
@@ -53,14 +55,20 @@ function TestSubstep(props: TestSubstepProps): React.ReactElement {
}, [expanded, reset])
const handleSubmit = React.useCallback(() => {
if (isCompleted) {
onContinue?.();
return;
}
executeFlow({
variables: {
input: {
stepId: step.id,
},
},
})
}, [onSubmit, step.id]);
});
}, [onSubmit, onContinue, isCompleted, step.id]);
const onToggle = expanded ? onCollapse : onExpand;
return (