From 9771e254d5d6a66aecbd7547d37d6fdcd0234a8a Mon Sep 17 00:00:00 2001 From: lane-formio Date: Wed, 18 Oct 2023 15:16:26 -0500 Subject: [PATCH] Revert "Fio 7074 setting submission on wizard does not update data (#5351)" This reverts commit 47d9ff34de705747447dc4a839b587e5f00a3160. --- src/Wizard.js | 25 +++++++++++-------------- src/Wizard.unit.js | 2 +- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/Wizard.js b/src/Wizard.js index da8bd99609..b514d19121 100644 --- a/src/Wizard.js +++ b/src/Wizard.js @@ -897,30 +897,27 @@ export default class Wizard extends Webform { } setValue(submission, flags = {}, ignoreEstablishment) { - const changed = this.getPages({ all: true }).reduce((changed, page) => { - return this.setNestedValue(page, submission.data, flags, changed) || changed; - }, false); - - if (!flags.sanitize || + this._submission = submission; + if ( + (flags && flags.fromSubmission && (this.options.readOnly || this.editMode) && !this.isHtmlRenderMode()) || (flags && flags.fromSubmission && (this.prefixComps.length || this.suffixComps.length) && submission._id) || (this.options.server && (this.prefixComps.length || this.suffixComps.length)) ) { - this.mergeData(this.data, submission.data); + this._data = submission.data; } + if (!ignoreEstablishment) { + this.establishPages(submission.data); + } + const changed = this.getPages({ all: true }).reduce((changed, page) => { + return this.setNestedValue(page, submission.data, flags, changed) || changed; + }, false); + if (changed) { this.pageFieldLogic(this.page); } - this.setEditMode(submission); - submission.data = this.data; - this._submission = submission; - - if (!ignoreEstablishment) { - this.establishPages(submission.data); - } - return changed; } diff --git a/src/Wizard.unit.js b/src/Wizard.unit.js index 1956a789d1..549dfcaf10 100644 --- a/src/Wizard.unit.js +++ b/src/Wizard.unit.js @@ -161,7 +161,7 @@ describe('Wizard tests', () => { }, 'Should contain correct submission data'); done(); - }, 500); + }, 200); }, 200); }, 200); }, 200);