feat(website): enhance lazy loading

This commit is contained in:
iCrawl
2023-03-24 04:27:21 +01:00
parent 3bd76078e1
commit 1c4af93898
6 changed files with 14 additions and 31 deletions

View File

@@ -31,10 +31,10 @@ export interface ItemLinkProps
* generate the full path to the item client-side.
*/
export function ItemLink(props: PropsWithChildren<ItemLinkProps>) {
const path = usePathname();
const pathname = usePathname();
const { packageName, version } = useCurrentPathMeta();
if (!path) {
if (!pathname) {
throw new Error('ItemLink must be used inside a Next.js page. (e.g. /docs/packages/foo/main)');
}