From d33e3858deb5233dd3517ee0e670eb2b0b0e7abf Mon Sep 17 00:00:00 2001 From: HannaKurban <96909212+HannaKurban@users.noreply.github.com> Date: Fri, 5 Apr 2024 10:15:05 +0300 Subject: [PATCH] FIO-8146 fixed saveDraft triggering for nested forms after submitting (#5556) * FIO-8146 fixed saveDraft triggering for nested forms after submitting * FIO-8146 refactoring --- src/components/form/Form.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/form/Form.js b/src/components/form/Form.js index 1c6b8e0f21..f5a150801a 100644 --- a/src/components/form/Form.js +++ b/src/components/form/Form.js @@ -644,6 +644,10 @@ export default class FormComponent extends Component { */ beforeSubmit() { const submission = this.dataValue; + // Cancel triggered saveDraft + if (this.subForm?.draftEnabled && this.subForm.triggerSaveDraft?.cancel) { + this.subForm.triggerSaveDraft.cancel(); + } const isAlreadySubmitted = submission && submission._id && submission.form;