Skip to content

Commit

Permalink
Validating draft only when record id does not change
Browse files Browse the repository at this point in the history
  • Loading branch information
CarliPinell committed Nov 11, 2024
1 parent 2e19bb6 commit 09009b1
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/components/renderer/form-collection-record-control.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ export default {
screenType: "",
hasMustache: false,
flagDraft: {},
taskDraft: {}
taskDraft: {},
enableDraft: true
};
},
computed: {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 09009b1

Please sign in to comment.