Skip to content

Commit

Permalink
handling potential undefined or null values in objects
Browse files Browse the repository at this point in the history
fixes thymeleaf render error
  • Loading branch information
Carl-OW committed Oct 9, 2023
1 parent f092de0 commit fa10b7b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/main/resources/site/layouts/triple/triple.es6
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import { render } from '/lib/thymeleaf'

const portal = __non_webpack_require__('/lib/xp/portal')

const view = resolve('triple.html')

exports.get = function (req) {
exports.get = function () {
const component = portal.getComponent()
const { title, hideTitle } = component.config

const model = {
title,
hideTitle,
leftRegion: component.regions.left,
centerRegion: component.regions.center,
rightRegion: component.regions.right,
leftRegion: component.regions?.left || { components: [] },
centerRegion: component.regions?.center || { components: [] },
rightRegion: component.regions?.right || { components: [] },
}

const body = render(view, model)
Expand Down

0 comments on commit fa10b7b

Please sign in to comment.