UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
fix: pagespeed optimization for docs page, suspense
Dillion Verma516bc00ec73d
diff --git a/apps/www/app/(docs)/docs/[[...slug]]/page.tsx b/apps/www/app/(docs)/docs/[[...slug]]/page.tsxindex 55d406c2..e2235f0f 100644--- a/apps/www/app/(docs)/docs/[[...slug]]/page.tsx+++ b/apps/www/app/(docs)/docs/[[...slug]]/page.tsx@@ -176,7 +176,6 @@ export default async function DocPage({ params }: DocPageProps) {className="flex items-stretch text-[1.05rem] sm:text-[15px] xl:w-full"><div className="flex min-w-0 flex-1 flex-col">- <div className="h-(--top-spacing) shrink-0" /><div className="mx-auto flex w-full max-w-3xl min-w-0 flex-1 flex-col gap-8 px-4 py-6 text-neutral-800 md:px-0 lg:py-8 dark:text-neutral-300"><div className="flex flex-col gap-2"><div className="flex flex-col gap-2">diff --git a/apps/www/app/(docs)/docs/layout.tsx b/apps/www/app/(docs)/docs/layout.tsxindex 64e49997..51152d8d 100644--- a/apps/www/app/(docs)/docs/layout.tsx+++ b/apps/www/app/(docs)/docs/layout.tsx@@ -1,3 +1,5 @@+import { Suspense } from "react"+import { SidebarProvider } from "@/components/ui/sidebar"import { DocsSidebar } from "@/components/docs-sidebar"@@ -10,7 +12,9 @@ export default function DocsLayout({<div className="container-wrapper flex flex-1 flex-col px-2"><SidebarProvider className="3xl:fixed:container 3xl:fixed:px-3 min-h-min flex-1 items-start px-0 [--sidebar-width:220px] [--top-spacing:0] lg:grid lg:grid-cols-[var(--sidebar-width)_minmax(0,1fr)] lg:[--sidebar-width:240px] lg:[--top-spacing:calc(var(--spacing)*4)]"><DocsSidebar />- <div className="h-full w-full">{children}</div>+ <Suspense>+ <div className="h-full w-full">{children}</div>+ </Suspense></SidebarProvider></div>)diff --git a/apps/www/app/(docs)/docs/loading.tsx b/apps/www/app/(docs)/docs/loading.tsxnew file mode 100644index 00000000..f97baca0--- /dev/null+++ b/apps/www/app/(docs)/docs/loading.tsx@@ -0,0 +1,60 @@+import { Skeleton } from "@/components/ui/skeleton"++export default function Loading() {+ return (+ <div className="flex items-stretch text-[1.05rem] sm:text-[15px] xl:w-full">+ <div className="flex min-w-0 flex-1 flex-col">+ <div className="mx-auto w-full max-w-3xl px-4 py-8 md:px-0">+ <div className="flex flex-col gap-8">+ {/* Breadcrumb skeleton */}+ <div className="flex items-center gap-2">+ <Skeleton className="h-4 w-16" />+ <Skeleton className="h-4 w-24" />+ <Skeleton className="h-4 w-24" />+ </div>++ {/* Title and description skeleton */}+ <div className="flex flex-col gap-4">+ <Skeleton className="h-16 w-full" />+ </div>++ {/* Content skeleton */}+ <div className="flex flex-col gap-4">+ <div className="my-4">+ <Skeleton className="h-64 w-full" />+ </div>++ <Skeleton className="h-4 w-full" />+ <Skeleton className="h-4 w-5/6" />+ <Skeleton className="h-4 w-full" />+ <Skeleton className="h-4 w-4/5" />+ </div>+ </div>+ </div>+ </div>+ {/* Right sidebar skeleton */}+ <div className="sticky top-[calc(var(--header-height)+1px)] z-30 ml-auto hidden h-[calc(100svh-var(--footer-height)+2rem)] w-84 flex-col gap-4 overflow-hidden overscroll-none xl:flex">+ <div className="h-(--top-spacing) shrink-0" />+ <div className="no-scrollbar overflow-y-auto px-8">+ {/* Table of contents skeleton */}+ <div className="flex flex-col gap-3">+ <Skeleton className="h-4 w-24" />+ <Skeleton className="h-3 w-32" />+ <Skeleton className="h-3 w-28" />+ <Skeleton className="h-3 w-36" />+ <Skeleton className="h-3 w-30" />+ <Skeleton className="h-3 w-34" />+ <Skeleton className="h-3 w-26" />+ <div className="h-6 w-full" />+ <Skeleton className="h-3 w-38" />+ <Skeleton className="h-3 w-32" />+ <Skeleton className="h-3 w-28" />+ </div>+ <div className="h-8" />+ {/* CTA block skeleton */}+ <Skeleton className="h-64 w-full" />+ </div>+ </div>+ </div>+ )+}diff --git a/apps/www/components/site-header.tsx b/apps/www/components/site-header.tsxindex dc9e2eca..f56c1f5c 100644--- a/apps/www/components/site-header.tsx+++ b/apps/www/components/site-header.tsx@@ -8,7 +8,7 @@ import { MainNav } from "@/components/main-nav"import { MobileNav } from "@/components/mobile-nav"import { ModeToggle } from "@/components/mode-toggle"-export async function SiteHeader() {+export function SiteHeader() {return (<header className="bg-background sticky top-0 z-50 w-full"><div className="container-wrapper 3xl:fixed:px-0 px-6">