Skip to content

Commit

Permalink
FIO-7074: Fixes an issue where setting submission to the Wizard from …
Browse files Browse the repository at this point in the history
…the form controller will not set values for all the pages
  • Loading branch information
alexandraRamanenka authored and lane-formio committed Oct 16, 2023
1 parent 59ec20a commit cd53c5e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
20 changes: 8 additions & 12 deletions src/Wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -896,18 +896,6 @@ export default class Wizard extends Webform {
}

setValue(submission, flags = {}, ignoreEstablishment) {
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._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);
Expand All @@ -922,8 +910,16 @@ export default class Wizard extends Webform {
if (changed) {
this.pageFieldLogic(this.page);
}

this.setEditMode(submission);

submission.data = this.data;
this._submission = submission;

if (!ignoreEstablishment) {
this.establishPages(submission.data);
}

return changed;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Wizard.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ describe('Wizard tests', () => {
}, 'Should contain correct submission data');

done();
}, 200);
}, 500);
}, 200);
}, 200);
}, 200);
Expand Down

0 comments on commit cd53c5e

Please sign in to comment.