Skip to content

Commit

Permalink
Merge pull request #2382 from shuhaib-aot/Bugfix/fixed-component-dele…
Browse files Browse the repository at this point in the history
…te-changes-capture

Fixed form component changes capturing for formchange and added confirmation for component delete
  • Loading branch information
arun-s-aot authored Nov 27, 2024
2 parents 4b6f5ea + ede72ae commit 1358ec3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions forms-flow-web/src/components/Form/EditForm/FormEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ const EditComponent = () => {
});
};

const formChange = (newForm) => {
const captureFormChanges = ()=>{
setFormChangeState((prev) => {
let key = null;
if (!prev.initial) {
Expand All @@ -649,7 +649,10 @@ const EditComponent = () => {
}
return key ? {...prev, [key]:true} : prev;
});

};

const formChange = (newForm) => {
captureFormChanges();
dispatchFormAction({ type: "formChange", value: newForm });
};

Expand Down Expand Up @@ -1055,10 +1058,13 @@ const EditComponent = () => {
key={form._id}
form={form}
onChange={formChange}

options={{
language: lang,
alwaysConfirmComponentRemoval:true,
i18n: RESOURCE_BUNDLES_DATA,
}}
onDeleteComponent={captureFormChanges}
/>
)}
</div>
Expand Down

0 comments on commit 1358ec3

Please sign in to comment.