diff --git a/apps/nextjs/src/app/aila/page-contents.tsx b/apps/nextjs/src/app/aila/page-contents.tsx index 8a174ef1b..1fdba15df 100644 --- a/apps/nextjs/src/app/aila/page-contents.tsx +++ b/apps/nextjs/src/app/aila/page-contents.tsx @@ -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 ( diff --git a/apps/nextjs/src/hooks/useReactScan.ts b/apps/nextjs/src/hooks/useReactScan.ts index 2addf8f7f..2f69b52d3 100644 --- a/apps/nextjs/src/hooks/useReactScan.ts +++ b/apps/nextjs/src/hooks/useReactScan.ts @@ -58,9 +58,9 @@ export const useReactScan = ( component?: React.ComponentType, interval?: number, ) => { - const [scanReports, setScanReports] = useState< - sortedReport | sortedReport[] | null - >(null); + // const [scanReports, setScanReports] = useState< + // sortedReport | sortedReport[] | null + // >(null); useEffect(() => { // const isRenderScanEnabled = @@ -70,6 +70,8 @@ export const useReactScan = ( // 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 { @@ -119,7 +121,7 @@ export const useReactScan = ( ); console.table(sortedReports); - setScanReports(sortedReports); + // setScanReports(sortedReports); } else if ( allReports !== null && allReports instanceof Map === false @@ -129,7 +131,7 @@ export const useReactScan = ( allReports, ]); log.info("Single Report:,", transformedReport); - setScanReports(transformedReport); + // setScanReports(transformedReport); setWindowObjectForPlaywright(component, transformedReport); } } catch (error) { @@ -145,6 +147,5 @@ export const useReactScan = ( analyzeRenders(); } } - }, [component, interval, setScanReports]); - return scanReports; + }, [component, interval]); }; diff --git a/apps/nextjs/tests-e2e/tests/chat-performance.test.ts b/apps/nextjs/tests-e2e/tests/chat-performance.test.ts index cb9a59f04..3ec0ec0cf 100644 --- a/apps/nextjs/tests-e2e/tests/chat-performance.test.ts +++ b/apps/nextjs/tests-e2e/tests/chat-performance.test.ts @@ -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( @@ -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, );