Skip to content

Commit

Permalink
Merge branch 'master' of github.com:formio/formio.js into fio4112
Browse files Browse the repository at this point in the history
  • Loading branch information
travist committed Apr 3, 2024
2 parents cdcbd44 + 083c8d0 commit d9b86fa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ Formio.createForm(document.getElementById('formio'), 'https://examples.form.io/e
- 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
Expand Down
5 changes: 3 additions & 2 deletions src/Webform.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions src/components/form/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export default class FormComponent extends Component {
}
}

/* eslint-disable max-statements */
getSubOptions(options = {}) {
options.events = this.createEmitter();

Expand Down Expand Up @@ -224,12 +225,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) {
Expand Down Expand Up @@ -456,10 +459,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();
Expand Down

0 comments on commit d9b86fa

Please sign in to comment.