Skip to content

Commit

Permalink
Fix layout evaluating multiple times and defaulting to the current on…
Browse files Browse the repository at this point in the history
…e after saving record
  • Loading branch information
Fajfa committed Feb 26, 2024
1 parent 9e623eb commit 57a307e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
6 changes: 3 additions & 3 deletions client/web/compose/src/mixins/record.js
Expand Up @@ -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()
Expand Down
9 changes: 2 additions & 7 deletions client/web/compose/src/views/Public/Pages/Records/View.vue
Expand Up @@ -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()
})
},
},
Expand Down Expand Up @@ -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,
}
Expand All @@ -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 = {}
Expand Down

0 comments on commit 57a307e

Please sign in to comment.