Merge pull request #1940 from automatisch/AUT-1039

Revert "feat: persist parameters values in FlowSubstep (#1505)"
This commit is contained in:
Ali BARIN
2024-06-20 15:57:47 +02:00
committed by GitHub

View File

@@ -5,13 +5,11 @@ import Collapse from '@mui/material/Collapse';
import ListItem from '@mui/material/ListItem';
import Button from '@mui/material/Button';
import Stack from '@mui/material/Stack';
import isEqual from 'lodash/isEqual';
import { EditorContext } from 'contexts/Editor';
import FlowSubstepTitle from 'components/FlowSubstepTitle';
import InputCreator from 'components/InputCreator';
import FilterConditions from './FilterConditions';
import { StepPropType, SubstepPropType } from 'propTypes/propTypes';
import { usePrevious } from 'hooks/usePrevious';
function FlowSubstep(props) {
const {
@@ -21,27 +19,13 @@ function FlowSubstep(props) {
onCollapse,
onSubmit,
step,
onChange,
} = props;
const prevStep = usePrevious(step);
const { name, arguments: args } = substep;
const editorContext = React.useContext(EditorContext);
const formContext = useFormContext();
const validationStatus = formContext.formState.isValid;
const onToggle = expanded ? onCollapse : onExpand;
React.useEffect(() => {
return () => {
if (!isEqual(prevStep?.parameters, formContext.getValues('parameters'))) {
onChange({
step: { ...step, parameters: formContext.getValues('parameters') },
});
}
};
}, []);
return (
<React.Fragment>
<FlowSubstepTitle