@formio/js 5.0.0-dev.5636.99a32e6 → 5.0.0-dev.5639.43f7313

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -787,7 +787,8 @@ class Webform extends NestedDataComponent_1.default {
787
787
  formio.loadSubmissions({
788
788
  params: {
789
789
  state: 'draft',
790
- owner: userId
790
+ owner: userId,
791
+ sort: '-created'
791
792
  }
792
793
  }).then(submissions => {
793
794
  if (submissions.length > 0 && !this.options.skipDraftRestore) {
@@ -630,9 +630,10 @@ class FormComponent extends Component_1.default {
630
630
  && submission._id
631
631
  && this.subForm.formio
632
632
  && lodash_1.default.isEmpty(submission.data);
633
- if (shouldLoadSubmissionById) {
633
+ const shouldLoadDraftById = this.options.saveDraft && lodash_1.default.isEmpty(submission.data) && lodash_1.default.get(this.subForm, 'submission._id');
634
+ if (shouldLoadSubmissionById || shouldLoadDraftById) {
634
635
  const formId = submission.form || this.formObj.form || this.component.form;
635
- const submissionUrl = `${this.subForm.formio.formsUrl}/${formId}/submission/${submission._id}`;
636
+ const submissionUrl = `${this.subForm.formio.formsUrl}/${formId}/submission/${submission._id || this.subForm.submission._id}`;
636
637
  const options = ((_a = this.root.formio) === null || _a === void 0 ? void 0 : _a.base) && ((_b = this.root.formio) === null || _b === void 0 ? void 0 : _b.projectUrl)
637
638
  ? {
638
639
  base: this.root.formio.base,
@@ -791,7 +791,8 @@ export default class Webform extends NestedDataComponent {
791
791
  formio.loadSubmissions({
792
792
  params: {
793
793
  state: 'draft',
794
- owner: userId
794
+ owner: userId,
795
+ sort: '-created'
795
796
  }
796
797
  }).then(submissions => {
797
798
  if (submissions.length > 0 && !this.options.skipDraftRestore) {
@@ -620,9 +620,10 @@ export default class FormComponent extends Component {
620
620
  && submission._id
621
621
  && this.subForm.formio
622
622
  && _.isEmpty(submission.data);
623
- if (shouldLoadSubmissionById) {
623
+ const shouldLoadDraftById = this.options.saveDraft && _.isEmpty(submission.data) && _.get(this.subForm, 'submission._id');
624
+ if (shouldLoadSubmissionById || shouldLoadDraftById) {
624
625
  const formId = submission.form || this.formObj.form || this.component.form;
625
- const submissionUrl = `${this.subForm.formio.formsUrl}/${formId}/submission/${submission._id}`;
626
+ const submissionUrl = `${this.subForm.formio.formsUrl}/${formId}/submission/${submission._id || this.subForm.submission._id}`;
626
627
  const options = this.root.formio?.base && this.root.formio?.projectUrl
627
628
  ? {
628
629
  base: this.root.formio.base,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5636.99a32e6",
3
+ "version": "5.0.0-dev.5639.43f7313",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {