From 3277fea4950feca3df743420eac656a5b61a51ff Mon Sep 17 00:00:00 2001 From: BigSimmo <87357024+BigSimmo@users.noreply.github.com> Date: Thu, 2 Jul 2026 16:15:02 +0800 Subject: [PATCH] fix: move ssr:false dynamic imports into client wrapper components PR #133 added next/dynamic with ssr:false directly in the home and document-viewer Server Components, which this Next version rejects. That broke next build (Failed to compile) and poisoned every fresh dev server: once the home page compiled, all routes returned 500, which is what collapsed the Playwright run mid-suite. Move the ssr:false dynamics into "use client" wrapper components (ClinicalDashboardLazy, DocumentViewerLazy) so the pages stay server components and the lazy client-only loading behavior is preserved. Verified: next build now passes the compile phase (remaining build failure is the known PR #131 typecheck debt), dev server serves home/identity/setup-status 200, full 3-browser e2e run in progress. Co-Authored-By: Claude Fable 5 --- src/app/documents/[id]/page.tsx | 7 +------ src/app/page.tsx | 7 +------ src/components/ClinicalDashboardLazy.tsx | 8 ++++++++ src/components/DocumentViewerLazy.tsx | 8 ++++++++ 4 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 src/components/ClinicalDashboardLazy.tsx create mode 100644 src/components/DocumentViewerLazy.tsx diff --git a/src/app/documents/[id]/page.tsx b/src/app/documents/[id]/page.tsx index b6de4af8b5..d9d074b377 100644 --- a/src/app/documents/[id]/page.tsx +++ b/src/app/documents/[id]/page.tsx @@ -1,9 +1,4 @@ -import dynamic from "next/dynamic"; - -const DocumentViewer = dynamic( - () => import("@/components/DocumentViewer").then((m) => m.DocumentViewer), - { ssr: false }, -); +import { DocumentViewer } from "@/components/DocumentViewerLazy"; export default async function DocumentPage({ params, diff --git a/src/app/page.tsx b/src/app/page.tsx index 73ba714477..bba87719e5 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,10 +1,5 @@ -import dynamic from "next/dynamic"; import { isAppModeId, isAppModeVisible, type AppModeId } from "@/lib/app-modes"; - -const ClinicalDashboard = dynamic( - () => import("@/components/clinical-dashboard").then((m) => m.ClinicalDashboard), - { ssr: false }, -); +import { ClinicalDashboard } from "@/components/ClinicalDashboardLazy"; type HomeProps = { searchParams?: Promise<{ diff --git a/src/components/ClinicalDashboardLazy.tsx b/src/components/ClinicalDashboardLazy.tsx new file mode 100644 index 0000000000..3e3532521e --- /dev/null +++ b/src/components/ClinicalDashboardLazy.tsx @@ -0,0 +1,8 @@ +"use client"; + +import dynamic from "next/dynamic"; + +export const ClinicalDashboard = dynamic( + () => import("@/components/clinical-dashboard").then((m) => m.ClinicalDashboard), + { ssr: false }, +); diff --git a/src/components/DocumentViewerLazy.tsx b/src/components/DocumentViewerLazy.tsx new file mode 100644 index 0000000000..3b55cc863f --- /dev/null +++ b/src/components/DocumentViewerLazy.tsx @@ -0,0 +1,8 @@ +"use client"; + +import dynamic from "next/dynamic"; + +export const DocumentViewer = dynamic( + () => import("@/components/DocumentViewer").then((m) => m.DocumentViewer), + { ssr: false }, +);