3
0

Fix layout evaluating multiple times and defaulting to the current one after saving record

This commit is contained in:
Jože Fortun
2024-02-26 14:16:28 +01:00
parent 9e623ebadc
commit 57a307ef07
2 changed files with 5 additions and 10 deletions

View File

@@ -175,11 +175,11 @@ export default {
moduleID: this.module.moduleID,
notPageID: this.page.pageID,
})
} else {
this.$router.push({ name: route, params: { ...this.$route.params, recordID: record.recordID } })
}
if (!isNew) {
if (isNew) {
this.$router.push({ name: route, params: { ...this.$route.params, recordID: record.recordID } })
} else {
this.record = record
// reset the record initial state in cases where the record edit page is opened on a modal
this.initialRecordState = this.record.clone()

View File

@@ -303,13 +303,10 @@ export default {
watch: {
recordID: {
immediate: true,
handler () {
handler (o, n) {
this.record = undefined
this.initialRecordState = undefined
this.refresh()
this.loadRecord().then(() => {
this.determineLayout()
})
},
},
@@ -524,7 +521,7 @@ export default {
layout: undefined,
isView: !this.inEditing && !this.inCreating,
isCreate: this.inCreating,
isEdit: this.inEditing,
isEdit: this.inEditing && !this.inCreating,
...variables,
}
@@ -546,8 +543,6 @@ export default {
},
async determineLayout (pageLayoutID, variables = {}) {
pageLayoutID = pageLayoutID || (this.layout || {}).pageLayoutID
// Clear stored records so they can be refetched with latest values
this.clearRecordSet()
let expressions = {}