Fix record not loading before blocks on record pages
This commit is contained in:
parent
7b40471f35
commit
6c75df8977
@ -3,22 +3,11 @@
|
||||
v-bind="$props"
|
||||
v-on="$listeners"
|
||||
>
|
||||
<label
|
||||
v-if="error"
|
||||
class="text-primary p-3"
|
||||
>
|
||||
{{ error }}
|
||||
</label>
|
||||
|
||||
<div
|
||||
v-else
|
||||
class="rt-content p-3"
|
||||
>
|
||||
<p
|
||||
:style="{ 'white-space': 'pre-wrap' }"
|
||||
class="rt-content p-3"
|
||||
v-html="contentBody"
|
||||
/>
|
||||
</div>
|
||||
</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 ''
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@ -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 = {}) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user