From 7367335868aecf2d5641ef3d0c1dacd85db87ad3 Mon Sep 17 00:00:00 2001 From: HannaKurban <96909212+HannaKurban@users.noreply.github.com> Date: Wed, 3 Apr 2024 16:48:43 +0300 Subject: [PATCH 1/2] FIO-8109 fixed save draft triggeribg for nested components (#5553) --- src/Webform.js | 5 +++-- src/components/form/Form.js | 7 +++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Webform.js b/src/Webform.js index e9541876bc..65cbce3ceb 100644 --- a/src/Webform.js +++ b/src/Webform.js @@ -794,12 +794,13 @@ export default class Webform extends NestedDataComponent { * @param {userId} - The user id where we need to restore the draft from. */ restoreDraft(userId) { - if (!this.formio) { + const formio = this.formio || this.options.formio; + if (!formio) { this.handleDraftError('restoreDraftInstanceError', null, true); return; } this.savingDraft = true; - this.formio.loadSubmissions({ + formio.loadSubmissions({ params: { state: 'draft', owner: userId diff --git a/src/components/form/Form.js b/src/components/form/Form.js index dd25eea54d..1c6b8e0f21 100644 --- a/src/components/form/Form.js +++ b/src/components/form/Form.js @@ -164,6 +164,7 @@ export default class FormComponent extends Component { } } + /* eslint-disable max-statements */ getSubOptions(options = {}) { options.parentPath = `${this.path}.data.`; options.events = this.createEmitter(); @@ -221,12 +222,14 @@ export default class FormComponent extends Component { } if (this.options.saveDraft) { options.saveDraft = this.options.saveDraft; + options.formio = new Formio(this.formSrc); } if (this.options.saveDraftThrottle) { options.saveDraftThrottle = this.options.saveDraftThrottle; } return options; } + /* eslint-enable max-statements */ render() { if (this.builderMode) { @@ -453,10 +456,6 @@ export default class FormComponent extends Component { this.subForm.nosubmit = true; this.subForm.root = this.root; this.subForm.localRoot = this.isNestedWizard ? this.localRoot : this.subForm; - if (this.parent) { - this.subForm.draftEnabled = this.parent.draftEnabled; - this.subForm.savingDraft = this.parent.savingDraft; - } this.restoreValue(); this.valueChanged = this.hasSetValue; this.onChange(); From 083c8d0070392b7c8d53b551b96b7619c08775c0 Mon Sep 17 00:00:00 2001 From: TanyaGashtold <61136841+TanyaGashtold@users.noreply.github.com> Date: Wed, 3 Apr 2024 16:49:41 +0300 Subject: [PATCH 2/2] Update Changelog.md --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index 4c55d36b86..135851581d 100644 --- a/Changelog.md +++ b/Changelog.md @@ -44,6 +44,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - FIO-7334: Fixes an issue where Radio values do not appear for Action Conditions settings - FIO-8009: fixed display of the required asterisk - FIO-8111: fixed saveDraft Trigger for nested forms + - FIO-8109: fixed save draft triggering for nested components ## 5.0.0-rc.37 ### Fixed