mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 07:25:38 -04:00
Replace nested loop queries with batch fetches using inArray() across discovery, tracking, metadata, settings, and system-health services. The biggest win is getContinueWatchingFeed() going from ~375+ queries to 5. Add a cached getSession() wrapper via React.cache() to deduplicate auth lookups shared between layouts and pages. Parallelize independent async operations in importTitle(), cacheImagesJob(), and the explore page. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import { Suspense } from "react";
|
|
import {
|
|
ContinueWatchingSectionSkeleton,
|
|
StatsSectionSkeleton,
|
|
TitleGridSectionSkeleton,
|
|
} from "@/components/skeletons";
|
|
import { getSession } from "@/lib/auth/session";
|
|
import { ContinueWatchingSection } from "./_components/continue-watching-section";
|
|
import { LibrarySection } from "./_components/library-section";
|
|
import { RecommendationsSection } from "./_components/recommendations-section";
|
|
import { StatsSection } from "./_components/stats-section";
|
|
import { WelcomeHeader } from "./_components/welcome-header";
|
|
|
|
export default async function DashboardPage() {
|
|
const session = await getSession();
|
|
if (!session) return null;
|
|
|
|
return (
|
|
<div className="space-y-10">
|
|
<WelcomeHeader name={session.user.name} />
|
|
|
|
<Suspense fallback={<StatsSectionSkeleton />}>
|
|
<StatsSection userId={session.user.id} />
|
|
</Suspense>
|
|
|
|
<Suspense fallback={<ContinueWatchingSectionSkeleton />}>
|
|
<ContinueWatchingSection userId={session.user.id} />
|
|
</Suspense>
|
|
|
|
<Suspense fallback={<TitleGridSectionSkeleton />}>
|
|
<LibrarySection userId={session.user.id} />
|
|
</Suspense>
|
|
|
|
<Suspense fallback={<TitleGridSectionSkeleton />}>
|
|
<RecommendationsSection userId={session.user.id} />
|
|
</Suspense>
|
|
</div>
|
|
);
|
|
}
|