diff --git a/src/app/page.tsx b/src/app/page.tsx index 32c7da01..82e3634a 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,5 +1,3 @@ -'use client'; - import Image from "next/image"; import logoDark from "../../public/sb_logo_dark_large.png"; import logoLight from "../../public/sb_logo_light_large.png"; diff --git a/src/app/repos/page.tsx b/src/app/repos/page.tsx index f6e66b75..5d871038 100644 --- a/src/app/repos/page.tsx +++ b/src/app/repos/page.tsx @@ -1,5 +1,4 @@ -'use client'; - +import { Suspense } from "react"; import { NavigationMenu } from "../navigationMenu"; import { RepositoryTable } from "./repositoryTable"; @@ -7,7 +6,9 @@ export default function ReposPage() { return (
- + Loading...
}> + + ) } \ No newline at end of file diff --git a/src/app/repos/repositoryTable.tsx b/src/app/repos/repositoryTable.tsx index 386bc5fd..2e7d0da6 100644 --- a/src/app/repos/repositoryTable.tsx +++ b/src/app/repos/repositoryTable.tsx @@ -1,25 +1,17 @@ -'use client'; - import { DataTable } from "@/components/ui/data-table"; import { columns, RepositoryColumnInfo } from "./columns"; +import { listRepositories } from "@/lib/server/searchService"; import { isServiceError } from "@/lib/utils"; -import { useQuery } from "@tanstack/react-query"; -import { useMemo } from "react"; -import { getRepos } from "../api/(client)/client"; -export const RepositoryTable = () => { - const { data: _repos } = useQuery({ - queryKey: ["repos"], - queryFn: () => getRepos(), - enabled: typeof window !== "undefined", - }); +export const RepositoryTable = async () => { + const _repos = await listRepositories(); - const repos = useMemo(() => { - if (isServiceError(_repos)) { - return []; - } + if (isServiceError(_repos)) { + return
Error fetching repositories
; + } - return _repos?.List.Repos.map((repo): RepositoryColumnInfo => ({ + const repos = _repos.List.Repos.map((repo): RepositoryColumnInfo => { + return { name: repo.Repository.Name, branches: repo.Repository.Branches.map((branch) => { return { @@ -34,10 +26,10 @@ export const RepositoryTable = () => { latestCommit: repo.Repository.LatestCommitDate, indexedFiles: repo.Stats.Documents, commitUrlTemplate: repo.Repository.CommitURLTemplate, - })).sort((a, b) => { - return new Date(b.lastIndexed).getTime() - new Date(a.lastIndexed).getTime(); - }) ?? []; - }, [_repos]); + } + }).sort((a, b) => { + return new Date(b.lastIndexed).getTime() - new Date(a.lastIndexed).getTime(); + }); return ( { const start = Date.now(); @@ -22,6 +24,7 @@ export const zoektFetch = async ({ "Content-Type": "application/json", }, body, + cache, } );