3
0

Fix record not loading before blocks on record pages

This commit is contained in:
Jože Fortun 2024-12-12 15:52:53 +01:00
parent 7b40471f35
commit 6c75df8977
2 changed files with 9 additions and 37 deletions

View File

@ -3,22 +3,11 @@
v-bind="$props"
v-on="$listeners"
>
<label
v-if="error"
class="text-primary p-3"
>
{{ error }}
</label>
<div
v-else
:style="{ 'white-space': 'pre-wrap' }"
class="rt-content p-3"
>
<p
:style="{ 'white-space': 'pre-wrap' }"
v-html="contentBody"
/>
</div>
v-html="contentBody"
/>
</wrap>
</template>
<script>
@ -29,30 +18,12 @@ import { NoID } from '@cortezaproject/corteza-js'
export default {
extends: base,
data () {
return {
error: null,
contentBody: '',
}
},
watch: {
'options.body': {
immediate: true,
handler () {
this.makeContentBody()
},
},
},
methods: {
makeContentBody () {
this.error = null
computed: {
contentBody () {
try {
const { body = '' } = this.options
this.contentBody = evaluatePrefilter(body, {
return evaluatePrefilter(body, {
record: this.record,
user: this.$auth.user || {},
recordID: (this.record || {}).recordID || NoID,
@ -60,7 +31,8 @@ export default {
userID: (this.$auth.user || {}).userID || NoID,
})
} catch (e) {
this.error = this.getToastMessage(e)
this.toastErrorHandler(e)
return ''
}
},
},

View File

@ -146,7 +146,7 @@ export default {
document.title = [title, this.namespace.name, this.$t('general:label.app-name.public')].filter(v => v).join(' | ')
}
await this.updateBlocks(variables)
this.updateBlocks(variables)
},
async updateBlocks (variables = {}) {