diff --git a/src/components/TocList.vue b/src/components/TocList.vue index 469b1a9e..c564daa8 100644 --- a/src/components/TocList.vue +++ b/src/components/TocList.vue @@ -20,7 +20,7 @@ export default { // Auto-expand a single top-level structure with children expandedStructures: this.level === 0 && this.structures.length === 1 - && this.structures[0].items.some((item) => item.items) + && this.structures[0].items?.some((item) => item.items) ? [true] : [], id: this.$store.getId(`toc-list-${Math.floor(Math.random() * 1e12)}`), diff --git a/src/plugins/store.js b/src/plugins/store.js index 77eba3c2..469ad328 100644 --- a/src/plugins/store.js +++ b/src/plugins/store.js @@ -133,7 +133,7 @@ function Store(args) { if (store.manifest.structures.some((structure) => structure.type === 'Range')) { return store.manifest.structures.length === 1 && store.manifest.structures[0].behavior?.includes('top') - ? store.manifest.structures[0].items + ? (store.manifest.structures[0].items || []) : store.manifest.structures; }