Skip to content

Commit 97d861e

Browse files
author
Henrik Ruscon
committed
improve store checks
1 parent 0de5410 commit 97d861e

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

src/components/Content.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<template>
22
<div class="content">
3-
<template v-if="groups.length !== 0">
3+
<template v-if="groups">
44
<section
5-
v-if="Object.keys(info).length !== 0"
5+
v-if="info"
66
id="intro"
77
class="method first-of-group">
88
<div class="method__area">

src/components/Sidebar.vue

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<template>
22
<div class="sidebar">
3-
<scroll-spy class="sidebar__navigation">
4-
<template v-if="Object.keys(info).length !== 0">
3+
<scroll-spy
4+
v-if="dataReady"
5+
class="sidebar__navigation">
6+
<template v-if="info">
57
<h5 class="sidebar__navigation__heading">Topics</h5>
68
<ul class="sidebar__navigation__items">
79
<li>
@@ -11,7 +13,7 @@
1113
</li>
1214
</ul>
1315
</template>
14-
<template v-if="groups.length !== 0">
16+
<template>
1517
<h5 class="sidebar__navigation__heading">API</h5>
1618
<ul class="sidebar__navigation__items">
1719
<li
@@ -44,7 +46,10 @@ export default {
4446
...mapGetters({
4547
info: 'hapi-docs/info',
4648
groups: 'hapi-docs/groupedPaths'
47-
})
49+
}),
50+
dataReady() {
51+
return this.groups && this.info
52+
}
4853
}
4954
}
5055
</script>

src/store/modules/hapi-docs.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import * as types from '../mutation-types'
33

44
export const state = {
55
host: '',
6-
scheme: [],
7-
info: {},
6+
scheme: '',
7+
info: null,
88
paths: [],
9-
groups: [],
9+
groups: null,
1010
tags: []
1111
}
1212

0 commit comments

Comments
 (0)