Skip to content

Commit

Permalink
chore: increase wait time
Browse files Browse the repository at this point in the history
  • Loading branch information
JBR90 committed Dec 17, 2024
1 parent 2109477 commit 2aadf15
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion apps/nextjs/src/app/aila/page-contents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ChatProvider } from "@/components/ContextProviders/ChatProvider";
import LessonPlanTrackingProvider from "@/lib/analytics/lessonPlanTrackingContext";

const ChatPageContents = ({ id }: { readonly id: string }) => {
useReactScan(LessonPlanDisplay, 5000);
useReactScan(LessonPlanDisplay, 1000);

return (
<Layout>
Expand Down
15 changes: 8 additions & 7 deletions apps/nextjs/src/hooks/useReactScan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ export const useReactScan = <T extends object>(
component?: React.ComponentType<T>,
interval?: number,
) => {
const [scanReports, setScanReports] = useState<
sortedReport | sortedReport[] | null
>(null);
// const [scanReports, setScanReports] = useState<
// sortedReport | sortedReport[] | null
// >(null);

useEffect(() => {
// const isRenderScanEnabled =
Expand All @@ -70,6 +70,8 @@ export const useReactScan = <T extends object>(
// window.NEXT_PUBLIC_ENABLE_RENDER_SCAN === "true") ||
// (typeof window !== "undefined" &&
// window.process?.env?.NEXT_PUBLIC_ENABLE_RENDER_SCAN === "true");

// if (!isRenderScanEnabled) return;
const isRenderScanEnabled = true;
if (isRenderScanEnabled) {
try {
Expand Down Expand Up @@ -119,7 +121,7 @@ export const useReactScan = <T extends object>(
);

console.table(sortedReports);
setScanReports(sortedReports);
// setScanReports(sortedReports);
} else if (
allReports !== null &&
allReports instanceof Map === false
Expand All @@ -129,7 +131,7 @@ export const useReactScan = <T extends object>(
allReports,
]);
log.info("Single Report:,", transformedReport);
setScanReports(transformedReport);
// setScanReports(transformedReport);
setWindowObjectForPlaywright(component, transformedReport);
}
} catch (error) {
Expand All @@ -145,6 +147,5 @@ export const useReactScan = <T extends object>(
analyzeRenders();
}
}
}, [component, interval, setScanReports]);
return scanReports;
}, [component, interval]);
};
4 changes: 2 additions & 2 deletions apps/nextjs/tests-e2e/tests/chat-performance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ test.describe("Component renders during lesson chat", () => {
// window.process.env.NEXT_PUBLIC_ENABLE_RENDER_SCAN = "true";
// }

await page.waitForTimeout(5000);
await page.waitForTimeout(10000);

console.log("Checking injected flag...");
const renderScanEnabled = await page.evaluate(
Expand All @@ -92,7 +92,7 @@ test.describe("Component renders during lesson chat", () => {
);
await page.keyboard.type(message);
await expect(textbox).toContainText(message);
await page.waitForTimeout(5000);
await page.waitForTimeout(10000);
const finalRenderAmount: number = await page.evaluate(
() => window.reactScanLessonPlanDisplay.renderCount,
);
Expand Down

0 comments on commit 2aadf15

Please sign in to comment.