Fix CV viewer hang: load guard requires seg only for non-CV cases#83
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #82. PR #82 fixed the JSON-parse hang by setting
segUrl = nullfor CV cases, but introduced a new hang: the load-effect guard at~line 1037blocks on!segUrl, so the CT never loaded and the spinner ran forever.Root cause:
ctUrlandsegUrlboth initialise tonull, so a bare!segUrlcheck can't distinguish "CV — intentionally no seg" from "sources not resolved yet".Three edits in
VisualizationPage.tsx:isCvCaseflag (line ~307) derived frompantsCase— computed once, available to the guard(!segUrl && !isCvCase)— CV passes through as CT-only oncectUrlis set; non-CV still requires bothrenderVisualizationcall:segUrl ?? undefined— convertsnull→undefinedto match thestring | undefinedsignature and avoid tripping downstream seg logicCV cases now load CT-only through the same path local NIfTI files already use.
Test plan
/case/CV_00000001) — CT loads, no spinner hang, no seg paneltsc -b— clean