Skip to content

Commit deadfce

Browse files
authored
Fix TypeError when childPages is undefined in generic-toc middleware (#59169)
1 parent fa68b9e commit deadfce

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/frame/middleware/context/generic-toc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ async function getTocItems(node: Tree, context: Context, opts: Options): Promise
131131
}
132132

133133
return await Promise.all(
134-
node.childPages.filter(filterHidden).map(async (child) => {
134+
(node.childPages || []).filter(filterHidden).map(async (child) => {
135135
const { page } = child
136136
const title = await page.renderProp('rawTitle', context, { textOnly: true })
137137
const octicon = page.octicon ?? null

0 commit comments

Comments
 (0)