Skip to content

Fix CV viewer hang: load guard requires seg only for non-CV cases#83

Merged
aperson30 merged 1 commit into
mainfrom
fix/cv-viewer-guard
Jul 18, 2026
Merged

Fix CV viewer hang: load guard requires seg only for non-CV cases#83
aperson30 merged 1 commit into
mainfrom
fix/cv-viewer-guard

Conversation

@aperson30

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #82. PR #82 fixed the JSON-parse hang by setting segUrl = null for CV cases, but introduced a new hang: the load-effect guard at ~line 1037 blocks on !segUrl, so the CT never loaded and the spinner ran forever.

Root cause: ctUrl and segUrl both initialise to null, so a bare !segUrl check can't distinguish "CV — intentionally no seg" from "sources not resolved yet".

Three edits in VisualizationPage.tsx:

  1. Component-level isCvCase flag (line ~307) derived from pantsCase — computed once, available to the guard
  2. Guard: (!segUrl && !isCvCase) — CV passes through as CT-only once ctUrl is set; non-CV still requires both
  3. renderVisualization call: segUrl ?? undefined — converts nullundefined to match the string | undefined signature and avoid tripping downstream seg logic

CV cases now load CT-only through the same path local NIfTI files already use.

Test plan

  • Open a CV case (/case/CV_00000001) — CT loads, no spinner hang, no seg panel
  • Open a PanTS case — CT + segmentation load as before (regression check)
  • tsc -b — clean

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
@aperson30
aperson30 merged commit e2027a9 into main Jul 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant