Skip to content

Commit

Permalink
Fix performance analysis version, copy to regression-analysis page
Browse files Browse the repository at this point in the history
  • Loading branch information
bhackett1024 committed Dec 12, 2024
1 parent 99c8e09 commit d6bf0e8
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
53 changes: 53 additions & 0 deletions src/pages/regression-analysis.tsx
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,
},
};
};
2 changes: 1 addition & 1 deletion src/performance/interfaceTypes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const PerformanceAnalysisVersion = 2;
export const PerformanceAnalysisVersion = 3;
export const DependencyGraphVersion = 4;

type ProtocolExecutionPoint = string;
Expand Down

0 comments on commit d6bf0e8

Please sign in to comment.