chore: small fix in the plugin

This commit is contained in:
Roman Hotsiy
2023-10-11 11:56:40 +08:00
committed by mDuo13
parent 7fe53b05db
commit f480162b4d

View File

@@ -15,6 +15,12 @@ export default function indexPagesPlugin() {
// this uses some internals, we will expose them in nicer way in the future releases // this uses some internals, we will expose them in nicer way in the future releases
const sidebarId = actions.routesSharedData.get(route.slug)?.['sidebar']; // TODO: implement a helper function for this const sidebarId = actions.routesSharedData.get(route.slug)?.['sidebar']; // TODO: implement a helper function for this
const sidebar = await readSharedData(sidebarId, actions.outdir); const sidebar = await readSharedData(sidebarId, actions.outdir);
if (!sidebar) {
console.log('Index route used with no sidebar', route.fsPath);
continue;
}
const item = findItemDeep(sidebar.items, route.fsPath); const item = findItemDeep(sidebar.items, route.fsPath);
const childrenPaths =(item.items || []).map(item => item.fsPath).filter(Boolean); const childrenPaths =(item.items || []).map(item => item.fsPath).filter(Boolean);