From ac0a2f0321d2c921138aa99e85a4e4cb629362be Mon Sep 17 00:00:00 2001 From: Aditya Sanjeev Date: Sat, 18 Jul 2026 00:38:43 -0700 Subject: [PATCH] Fix CV viewer hang: load guard requires seg only for non-CV cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #82 set segUrl=null for CV cases to skip the JSON-returning seg endpoint, but the load-effect guard blocked on !segUrl, so the CT never loaded and the spinner ran forever. Three edits: 1. Component-level isCvCase flag so the guard can distinguish "CV, intentionally no seg" from "sources not resolved yet" (both start as null) 2. Guard: (!segUrl && !isCvCase) — seg only required for non-CV cases 3. renderVisualization: segUrl ?? undefined — null → undefined matches the string|undefined signature and avoids tripping downstream seg logic --- PanTS-Demo/src/routes/VisualizationPage.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PanTS-Demo/src/routes/VisualizationPage.tsx b/PanTS-Demo/src/routes/VisualizationPage.tsx index 2e928f4..b2e2b4c 100644 --- a/PanTS-Demo/src/routes/VisualizationPage.tsx +++ b/PanTS-Demo/src/routes/VisualizationPage.tsx @@ -304,6 +304,7 @@ function VisualizationPage() { // References and state const params = useParams(); const pantsCase = params.caseId; + const isCvCase = String(pantsCase ?? "").toUpperCase().startsWith("CV"); const sessionId = params.sessionId; // Local DICOM mode (/dicom): a folder of .dcm files picked on the Upload page, // viewed entirely in-browser. No backend case, so no segmentation layer. @@ -1030,7 +1031,7 @@ function VisualizationPage() { if ( !ctUrl || - !segUrl || + (!segUrl && !isCvCase) || // CV is CT-only; only require seg for non-CV cases !axial_ref.current || !sagittal_ref.current || !coronal_ref.current || @@ -1047,7 +1048,7 @@ function VisualizationPage() { coronal_ref.current, cmap, ctUrl, - segUrl, + segUrl ?? undefined, setLoading );