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);