fix: gracefully handle no docs

This commit is contained in:
iCrawl
2023-11-08 03:23:51 +01:00
parent defeee5eec
commit f713e47b0a
2 changed files with 9 additions and 4 deletions

View File

@@ -103,13 +103,18 @@ export async function generateMetadata({ params }: { params: ItemRouteParams })
export async function generateStaticParams({ params: { package: packageName, version } }: { params: ItemRouteParams }) {
const modelJSON = await fetchModelJSON(packageName, version);
if (!modelJSON) {
return [];
}
const model = addPackageToModel(new ApiModel(), modelJSON);
const pkg = model.tryGetPackageByName(packageName);
const entry = pkg?.entryPoints[0];
if (!entry) {
notFound();
return [];
}
return entry.members.map((member: ApiItem) => ({