Skip to content

Commit f35cf47

Browse files
feedback
1 parent f8ef1a8 commit f35cf47

File tree

2 files changed

+20
-23
lines changed

2 files changed

+20
-23
lines changed

packages/web/src/app/[domain]/browse/[...path]/components/codePreviewPanel.tsx

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
import { getCodeHostInfoForRepo, isServiceError, unwrapServiceError } from "@/lib/utils";
2-
import { useBrowseParams } from "@/app/[domain]/browse/hooks/useBrowseParams";
3-
import { useQuery } from "@tanstack/react-query";
4-
import { getFileSource } from "@/features/search/fileSourceApi";
5-
import { useDomain } from "@/hooks/useDomain";
6-
import { Loader2 } from "lucide-react";
7-
import { Separator } from "@/components/ui/separator";
81
import { getRepoInfoByName } from "@/actions";
9-
import { cn } from "@/lib/utils";
2+
import { PathHeader } from "@/app/[domain]/components/pathHeader";
3+
import { Separator } from "@/components/ui/separator";
4+
import { getFileSource } from "@/features/search/fileSourceApi";
5+
import { cn, getCodeHostInfoForRepo, isServiceError } from "@/lib/utils";
106
import Image from "next/image";
117
import { PureCodePreviewPanel } from "./pureCodePreviewPanel";
12-
import { PathHeader } from "@/app/[domain]/components/pathHeader";
138

149
interface CodePreviewPanelProps {
1510
path: string;
@@ -19,13 +14,14 @@ interface CodePreviewPanelProps {
1914
}
2015

2116
export const CodePreviewPanel = async ({ path, repoName, revisionName, domain }: CodePreviewPanelProps) => {
22-
const fileSourceResponse = await getFileSource({
23-
fileName: path,
24-
repository: repoName,
25-
branch: revisionName,
26-
}, domain);
27-
28-
const repoInfoResponse = await getRepoInfoByName(repoName, domain);
17+
const [fileSourceResponse, repoInfoResponse] = await Promise.all([
18+
getFileSource({
19+
fileName: path,
20+
repository: repoName,
21+
branch: revisionName,
22+
}, domain),
23+
getRepoInfoByName(repoName, domain),
24+
]);
2925

3026
if (isServiceError(fileSourceResponse) || isServiceError(repoInfoResponse)) {
3127
return <div>Error loading file source</div>

packages/web/src/app/[domain]/browse/[...path]/components/treePreviewPanel.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ interface TreePreviewPanelProps {
1414
}
1515

1616
export const TreePreviewPanel = async ({ path, repoName, revisionName, domain }: TreePreviewPanelProps) => {
17-
const repoInfoResponse = await getRepoInfoByName(repoName, domain);
18-
19-
const folderContentsResponse = await getFolderContents({
20-
repoName,
21-
revisionName: revisionName ?? 'HEAD',
22-
path,
23-
}, domain);
17+
const [repoInfoResponse, folderContentsResponse] = await Promise.all([
18+
getRepoInfoByName(repoName, domain),
19+
getFolderContents({
20+
repoName,
21+
revisionName: revisionName ?? 'HEAD',
22+
path,
23+
}, domain)
24+
]);
2425

2526
if (isServiceError(folderContentsResponse) || isServiceError(repoInfoResponse)) {
2627
return <div>Error loading tree preview</div>

0 commit comments

Comments
 (0)