mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 03:23:29 +01:00
fix(website): don't crash if no version was found
This commit is contained in:
@@ -2,6 +2,7 @@ import { readFile } from 'node:fs/promises';
|
||||
import { join } from 'node:path';
|
||||
import rehypeShikiFromHighlighter from '@shikijs/rehype/core';
|
||||
import type { Metadata } from 'next';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { MDXRemote } from 'next-mdx-remote-client/rsc';
|
||||
import remarkGfm from 'remark-gfm';
|
||||
import { DocItem } from '@/components/DocItem';
|
||||
@@ -89,6 +90,7 @@ export default async function Page({
|
||||
}
|
||||
|
||||
const entryPointString = parsedEntrypoints.join('.');
|
||||
|
||||
const node = await fetchNode({
|
||||
entryPoint: entryPointString,
|
||||
item: decodeURIComponent(foundItem),
|
||||
@@ -96,6 +98,10 @@ export default async function Page({
|
||||
version,
|
||||
});
|
||||
|
||||
if (!node) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="mx-auto flex w-full max-w-screen-xl flex-col gap-8 px-6 py-4">
|
||||
<DocItem node={node} packageName={packageName} version={version} />
|
||||
|
||||
Reference in New Issue
Block a user