-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix performance analysis version, copy to regression-analysis page
- Loading branch information
1 parent
99c8e09
commit d6bf0e8
Showing
2 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import dynamic from "next/dynamic"; | ||
|
||
import { PerformanceAnalysisResult } from "../performance/interfaceTypes"; | ||
import { GetServerSideProps } from "next/types"; | ||
import { fetchPerformanceResult } from "@/performance/performanceResult"; | ||
import { VerticalLayout } from "@/components/VerticalLayout"; | ||
|
||
// Dynamically import your CRA's App component with SSR disabled | ||
const PerformanceMockup = dynamic(() => import("../components/PerformanceMockup"), { ssr: false }); | ||
|
||
type PAProps = | ||
| { | ||
type: "error"; | ||
message: string; | ||
} | ||
| { | ||
type: "success"; | ||
recordingId: string; | ||
result: PerformanceAnalysisResult; | ||
}; | ||
|
||
export default function PerformanceAnalysis(props: PAProps) { | ||
if (props.type === "error") { | ||
return <div>Invalid or missing recordingId</div>; | ||
} | ||
|
||
return <PerformanceMockup recordingId={props.recordingId} result={props.result} />; | ||
} | ||
|
||
PerformanceAnalysis.Layout = VerticalLayout; | ||
|
||
export const getServerSideProps: GetServerSideProps = async function ({ params, req, query }) { | ||
const { recordingId } = query; | ||
|
||
if (typeof recordingId !== "string") { | ||
return { | ||
props: { | ||
status: "error", | ||
error: "Invalid or missing recordingId", | ||
}, | ||
}; | ||
} | ||
|
||
const result = await fetchPerformanceResult(recordingId); | ||
|
||
return { | ||
props: { | ||
status: "success", | ||
recordingId, | ||
result, | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters