Skip to content

fix(app): display study not found message for all modes#5752

Open
GhadeerAlbattarni wants to merge 10 commits intoOHIF:masterfrom
GhadeerAlbattarni:fix/5705-study-not-found-message
Open

fix(app): display study not found message for all modes#5752
GhadeerAlbattarni wants to merge 10 commits intoOHIF:masterfrom
GhadeerAlbattarni:fix/5705-study-not-found-message

Conversation

@GhadeerAlbattarni
Copy link
Contributor

Context

Fixes #5705

This PR fixes an issue where the study-not-found message was not displayed for tmtv, microscopy, and dynamic-volume modes.

Root Cause

The study validation logic lives in PanelStudyBrowser.tsx, which is not rendered when leftPanelClosed is true (tmtv, microscopy) or when a different panel is used (dynamic-volume). As a result, the validation logic does not run in these cases, causing users to see an infinite loading screen instead of the error message.

Changes & Results

This PR adds an early validation step in defaultRouteInit.ts that:

  • Queries each study before retrieving series metadata
  • Navigates to /notfoundstudy if any study is not found

This ensures validation runs for all modes during route initialization, before layout rendering.

Screenshot 2026-01-28 at 10 58 11 AM

Testing

  • Open a study from one of these modes tmtv, microscopy, and dynamic-volume then modify the StudyInstanceUIDs
  • Verify the study not found message displayed and redirect to notfoundstudy page

Checklist

PR

  • [] My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

  • My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • [] OS: macOS 10.15.4
  • [] Node version: v22.12.0
  • [] Browser: Chrome 83.0.4103.116

@netlify
Copy link

netlify bot commented Jan 28, 2026

Deploy Preview for ohif-dev canceled.

Name Link
🔨 Latest commit 960bdf6
🔍 Latest deploy log https://app.netlify.com/projects/ohif-dev/deploys/69820aeec8c471000841dd2b

@jbocce jbocce self-requested a review January 28, 2026 17:52
Copy link
Collaborator

@jbocce jbocce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. See my comment. Also please add a Playwright test for this, but instead of using screen shots, let's use assertion/expect statements by querying the DOM. Also we should think about whether we want some type of error page object in the tests for this or not.

- Moved validation from defaultRouteInit.ts to Mode.tsx
- Added dedicated useEffect hook for study validation
@GhadeerAlbattarni
Copy link
Contributor Author

I'll work next on writing the Playwright test

Copy link
Collaborator

@jbocce jbocce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great thus far. See my comments. Looking forward to the test that you are adding.

Copy link
Collaborator

@jbocce jbocce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there... just a few touch ups. Thanks so much.

const modes = ['viewer', 'segmentation', 'microscopy', 'tmtv'];

modes.forEach(mode => {
test(`should display error page when study UID is not found in ${mode} mode`, async ({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also add a series of tests where one study is valid and the other is not valid. Funny that I added this comment yesterday, but may github ate it. 🤣🤣

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be clear the goto URL should have two studies: one valid and one invalid.

className="mt-2"
data-cy="return-to-study-list-message"
>
Return to the{' '}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice change here. Thanks.

Copy link
Collaborator

@jbocce jbocce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one set of tests and I think you are good to go.

Copy link
Collaborator

@jbocce jbocce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff! Approved.

@GhadeerAlbattarni
Copy link
Contributor Author

Thanks Joe for your review!

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.

[Bug] Study not found message not displayed when launching from some modes

2 participants