Skip to content

Commit

Permalink
Overview tab: Fix javascript error (#2414)
Browse files Browse the repository at this point in the history
Fixes this error:
```
app.30bb9074a7a632ce30a5.js:2 TypeError: Cannot read properties of undefined (reading 'length')
    at i.overviewPage (app.30bb9074a7a632ce30a5.js:2:1827039)
    …
```

Also refactor the code for better readability.

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
  • Loading branch information
jimtng committed Feb 26, 2024
1 parent 3b694d2 commit e2738b5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions bundles/org.openhab.ui/web/src/pages/home/overview-tab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,14 @@ export default {
},
overviewPage () {
const page = this.$store.getters.page('overview')
if (!page) return null
if (page.component !== 'oh-layout-page') return null
if (!page.slots || (!page.slots.default.length && !page.slots.masonry && !page.slots.canvas && !page.slots.grid)) return null
return page
if (page) {
if (page.component === 'oh-layout-page') return page
if (page.slots) {
if (page.slots.default && page.slots.default.length) return page
if (page.slots.masonry || page.slots.canvas || page.slots.grid) return page
}
}
return null
},
overviewPageContext () {
return {
Expand Down

0 comments on commit e2738b5

Please sign in to comment.