Skip to content

Commit

Permalink
Revert "Fio 7074 setting submission on wizard does not update data (#…
Browse files Browse the repository at this point in the history
…5351)" (#5385)

This reverts commit 47d9ff3.
  • Loading branch information
lane-formio authored Oct 19, 2023
1 parent 4c407be commit 8fdc035
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
25 changes: 11 additions & 14 deletions src/Wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

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();
}, 500);
}, 200);
}, 200);
}, 200);
}, 200);
Expand Down

0 comments on commit 8fdc035

Please sign in to comment.