VTK toolbar is not displayed if user clicks on 2D MPR button before image loads in viewport
Bug Report
Description
If user drags a thumbnail and clicks on 2D MPR button too fast, without waiting for the image to load on the single viewport the button Exit 2D MPR is displayed with the Cornerstone toolbar instead of the VTK toolbar.
This scenario is tricky to reproduce manually, but it is constantly falling on the test automation.
Steps to Reproduce
- Load studies for patient name: Juno
- Drag the 3rd thumbnail into the viewport
- Before waiting the image to load, click on button
2D MPR
Steps to Reproduce on Test Automation:
- Go to file
platform/viewer/cypress/integration/pwa/OHIFExtensionVTK.spec.js - Comment the command
cy.wait(1000)in line 26. - On terminal, navigate to path:
Viewers/platform/viewer/ - Execute the test automation by running:
yarn run test:e2e
Actual Result
The button Exit 2D MPR is displayed with the Cornerstone toolbar instead of the VTK toolbar.

Expected Result
The button Exit 2D MPR should only be displayed when the VTK tools are active and the viewport layout split into 3 viewports.
@galelis I don't believe this is fixed by #1241. I am still able to reproduce. You'll see an error in the console: updateImage: image has not been loaded yet

The issue is, the button click updates state, but something is exiting early when we try to make the switch. Viewports show previous, but toolbar updates in response to the context change.
Not 100% sure why.
Hi @dannyrb and @galelis , great job! Thanks! I did several tests and the bug mentioned in this issue is fixed. But I also found some others 🐛😄 The bugs found were described on #1326 . I'm moving this issue to Done.