From 11aef97d1c337acd2a4e6c5f564e8881df19f2bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C5=BEe=20Fortun?= Date: Fri, 7 Apr 2023 13:58:24 +0200 Subject: [PATCH] Fix bulk record edit modal fields and values not resetting on save --- .../components/PageBlocks/RecordListBase.vue | 3 ++- .../Public/Record/BulkEdit/index.vue | 1 + client/web/compose/src/mixins/record.js | 22 ++++++------------- .../compose/src/views/Admin/Pages/Edit.vue | 6 ++--- .../compose/src/views/Public/Pages/View.vue | 2 +- 5 files changed, 14 insertions(+), 20 deletions(-) diff --git a/client/web/compose/src/components/PageBlocks/RecordListBase.vue b/client/web/compose/src/components/PageBlocks/RecordListBase.vue index 5f5177c38..602fcebf3 100644 --- a/client/web/compose/src/components/PageBlocks/RecordListBase.vue +++ b/client/web/compose/src/components/PageBlocks/RecordListBase.vue @@ -1679,7 +1679,8 @@ export default { onInlineEdit () { this.refresh(true) - this.inlineEditRecords = [] + this.inlineEdit.fields = [] + this.inlineEdit.recordIDs = [] }, isFieldEditable (field) { diff --git a/client/web/compose/src/components/Public/Record/BulkEdit/index.vue b/client/web/compose/src/components/Public/Record/BulkEdit/index.vue index 0798b6cb9..89368f25d 100644 --- a/client/web/compose/src/components/Public/Record/BulkEdit/index.vue +++ b/client/web/compose/src/components/Public/Record/BulkEdit/index.vue @@ -211,6 +211,7 @@ export default { if (this.openOnSelect) { this.fields = [] + this.record = new compose.Record(this.module, {}) } }, diff --git a/client/web/compose/src/mixins/record.js b/client/web/compose/src/mixins/record.js index 956fe7b2e..aacb048a2 100644 --- a/client/web/compose/src/mixins/record.js +++ b/client/web/compose/src/mixins/record.js @@ -294,21 +294,13 @@ export default { throw err }) - .then(({ records }) => { - return records[0] - }) - .then((record) => { - this.updatePrompts() - return record - }) - .then((record) => { - if (record.valueErrors && record.valueErrors.set) { - this.toastWarning(this.$t('notification:record.validationWarnings')) - } else { - this.toastSuccess(this.$t('notification:record.bulkRecordUpdateSuccess')) - this.onModalHide() - this.$emit('save') - } + .then(this.updatePrompts()) + .then(() => { + this.toastSuccess(this.$t('notification:record.bulkRecordUpdateSuccess')) + this.onModalHide() + this.fields = [] + this.record = new compose.Record(this.module, {}) + this.$emit('save') }) .catch(this.toastErrorHandler(this.$t('notification:record.deleteBulkRecordUpdateFailed'))) .finally(() => { diff --git a/client/web/compose/src/views/Admin/Pages/Edit.vue b/client/web/compose/src/views/Admin/Pages/Edit.vue index e9443b341..0416e911f 100644 --- a/client/web/compose/src/views/Admin/Pages/Edit.vue +++ b/client/web/compose/src/views/Admin/Pages/Edit.vue @@ -20,7 +20,7 @@ > {{ $t('label.pageBuilder') }} @@ -175,7 +175,7 @@ @click="openIconModal" > @@ -322,7 +322,7 @@ :to="{ name: 'admin.pages.builder', query: { layoutID: layout.pageLayoutID} }" > diff --git a/client/web/compose/src/views/Public/Pages/View.vue b/client/web/compose/src/views/Public/Pages/View.vue index c4b6ec27f..735992154 100644 --- a/client/web/compose/src/views/Public/Pages/View.vue +++ b/client/web/compose/src/views/Public/Pages/View.vue @@ -21,7 +21,7 @@ > {{ $t('general:label.pageBuilder') }}