Fix layout evaluating multiple times and defaulting to the current one after saving record
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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 = {}
|
||||
|
||||
Reference in New Issue
Block a user