Fix page not rendering if block not found in layout

This commit is contained in:
Jože Fortun
2024-03-12 12:36:48 +01:00
parent a505e3d8e5
commit 6b17e27e76
2 changed files with 22 additions and 6 deletions
@@ -593,11 +593,19 @@ export default {
return acc
}, new Set())
this.blocks = (this.layout || {}).blocks.map(({ blockID, xywh }) => {
const tempBlocks = []
const { blocks = [] } = this.layout || {}
blocks.forEach(({ blockID, xywh }) => {
const block = this.page.blocks.find(b => b.blockID === blockID)
block.xywh = xywh
return block
if (block) {
block.xywh = xywh
tempBlocks.push(block)
}
})
this.blocks = tempBlocks
},
refetchRecordBlocks () {
@@ -297,11 +297,19 @@ export default {
this.pageTitle = title || handle || this.$t('navigation:noPageTitle')
document.title = [title, this.namespace.name, this.$t('general:label.app-name.public')].filter(v => v).join(' | ')
this.blocks = (this.layout || {}).blocks.map(({ blockID, xywh }) => {
const tempBlocks = []
const { blocks = [] } = this.layout || {}
blocks.forEach(({ blockID, xywh }) => {
const block = this.page.blocks.find(b => b.blockID === blockID)
block.xywh = xywh
return block
if (block) {
block.xywh = xywh
tempBlocks.push(block)
}
})
this.blocks = tempBlocks
},
refetchRecords () {