From 09009b16b604273ef54c380df47ac7e84e646eba Mon Sep 17 00:00:00 2001 From: CarliPinell Date: Mon, 11 Nov 2024 15:09:18 -0400 Subject: [PATCH] Validating draft only when record id does not change --- .../renderer/form-collection-record-control.vue | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/renderer/form-collection-record-control.vue b/src/components/renderer/form-collection-record-control.vue index 44395044b..74640d726 100644 --- a/src/components/renderer/form-collection-record-control.vue +++ b/src/components/renderer/form-collection-record-control.vue @@ -61,7 +61,8 @@ export default { screenType: "", hasMustache: false, flagDraft: {}, - taskDraft: {} + taskDraft: {}, + enableDraft: true }; }, computed: { @@ -181,12 +182,9 @@ export default { (this.selDisplayMode === "View" ? viewScreen : editScreen); this.loadScreen(this.screenCollectionId); - //This section validates if Collection has draft data and if the record is different to the draft record - if ( - this.taskDraft?.draft?.data == null || - this.taskDraft.draft.data === '' || - String(this.selRecordId) !== this.taskDraft.draft.data.id - ) { + //This section validates if Collection has draft data + if (this.taskDraft?.draft?.data == null || this.taskDraft.draft.data === '' || !this.enableDraft) + { this.localData = respData; }else{ this.localData = _.merge({}, respData, this.taskDraft.draft.data); @@ -218,6 +216,7 @@ export default { }, record(record) { this.hasMustache = false; + this.enableDraft = false; if (record && !isNaN(record) && record > 0 && this.collection.collectionId) { this.selRecordId = record; this.loadRecordCollection(this.collection.collectionId, record, this.selDisplayMode);