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" ;
8
1
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" ;
10
6
import Image from "next/image" ;
11
7
import { PureCodePreviewPanel } from "./pureCodePreviewPanel" ;
12
- import { PathHeader } from "@/app/[domain]/components/pathHeader" ;
13
8
14
9
interface CodePreviewPanelProps {
15
10
path : string ;
@@ -19,13 +14,14 @@ interface CodePreviewPanelProps {
19
14
}
20
15
21
16
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
+ ] ) ;
29
25
30
26
if ( isServiceError ( fileSourceResponse ) || isServiceError ( repoInfoResponse ) ) {
31
27
return < div > Error loading file source</ div >
0 commit comments