From e5286d9fc2449da50b738e7e6208d489cce1633e Mon Sep 17 00:00:00 2001 From: Alireza Date: Tue, 3 Dec 2024 09:14:41 -0500 Subject: [PATCH] fix(modes): don't attempt to retrieve a stage index if HPs (#4552) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ibrahim <93064150+IbrahimCSAE@users.noreply.github.com> Co-authored-by: Ștefan Silviu-Alexandru --- .github/workflows/playwright.yml | 2 ++ addOns/externals/devDependencies/package.json | 2 +- .../cornerstone-dicom-pmap/package.json | 2 +- extensions/cornerstone-dicom-seg/package.json | 2 +- extensions/cornerstone/package.json | 2 +- .../CornerstoneViewportService.ts | 15 ++++++++++ platform/app/cypress/support/commands.js | 2 +- platform/app/src/components/ViewportGrid.tsx | 2 +- platform/app/src/routes/Mode/Mode.tsx | 8 ++--- .../Errorboundary/ErrorBoundary.tsx | 30 +++++++++---------- version.txt | 2 +- yarn.lock | 22 -------------- 12 files changed, 43 insertions(+), 48 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index d4a5cbf2079..e97f4211cb6 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -8,6 +8,8 @@ jobs: playwright-tests: timeout-minutes: 60 runs-on: ubuntu-latest + container: + image: mcr.microsoft.com/playwright:v1.49.0-noble strategy: fail-fast: false matrix: diff --git a/addOns/externals/devDependencies/package.json b/addOns/externals/devDependencies/package.json index 01329939504..fefcad07900 100644 --- a/addOns/externals/devDependencies/package.json +++ b/addOns/externals/devDependencies/package.json @@ -10,7 +10,7 @@ }, "dependencies": { "@babel/runtime": "^7.20.13", - "@kitware/vtk.js": "32.1.0", + "@kitware/vtk.js": "32.1.1", "clsx": "^2.1.1", "core-js": "^3.2.1", "moment": "^2.9.4" diff --git a/extensions/cornerstone-dicom-pmap/package.json b/extensions/cornerstone-dicom-pmap/package.json index 8ddc92f9992..0885dbf8ec9 100644 --- a/extensions/cornerstone-dicom-pmap/package.json +++ b/extensions/cornerstone-dicom-pmap/package.json @@ -48,7 +48,7 @@ "@babel/runtime": "^7.20.13", "@cornerstonejs/adapters": "^2.2.20", "@cornerstonejs/core": "^2.2.20", - "@kitware/vtk.js": "32.1.0", + "@kitware/vtk.js": "32.1.1", "react-color": "^2.19.3" } } diff --git a/extensions/cornerstone-dicom-seg/package.json b/extensions/cornerstone-dicom-seg/package.json index 9a2aa3df7a1..8b1a561257b 100644 --- a/extensions/cornerstone-dicom-seg/package.json +++ b/extensions/cornerstone-dicom-seg/package.json @@ -48,7 +48,7 @@ "@babel/runtime": "^7.20.13", "@cornerstonejs/adapters": "^2.2.20", "@cornerstonejs/core": "^2.2.20", - "@kitware/vtk.js": "32.1.0", + "@kitware/vtk.js": "32.1.1", "react-color": "^2.19.3" } } diff --git a/extensions/cornerstone/package.json b/extensions/cornerstone/package.json index 757b2c34295..d6e760ffd92 100644 --- a/extensions/cornerstone/package.json +++ b/extensions/cornerstone/package.json @@ -59,7 +59,7 @@ "@cornerstonejs/core": "^2.2.20", "@cornerstonejs/tools": "^2.2.20", "@icr/polyseg-wasm": "^0.4.0", - "@kitware/vtk.js": "32.1.0", + "@kitware/vtk.js": "32.1.1", "html2canvas": "^1.4.1", "lodash.debounce": "^4.0.8", "lodash.merge": "^4.6.2", diff --git a/extensions/cornerstone/src/services/ViewportService/CornerstoneViewportService.ts b/extensions/cornerstone/src/services/ViewportService/CornerstoneViewportService.ts index f156be60a7c..c07a4de01e2 100644 --- a/extensions/cornerstone/src/services/ViewportService/CornerstoneViewportService.ts +++ b/extensions/cornerstone/src/services/ViewportService/CornerstoneViewportService.ts @@ -130,6 +130,21 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi * individual resize observers */ public resize(isGridResize = false) { + // https://stackoverflow.com/a/26279685 + // This resize() call, among other things, rerenders the viewports. But when the entire viewer is + // display: none'd, it makes the size of all hidden elements 0, including the viewport canvas and its containers. + // Even if the viewer is later displayed again, trying to render when the size is 0 permanently "breaks" the + // viewport, making it fully black even after the size is normal again. So just ignore resize events when hidden: + const areViewportsHidden = Array.from(this.viewportsById.values()).every(viewportInfo => { + const element = viewportInfo.getElement(); + + return element.clientWidth === 0 && element.clientHeight === 0; + }); + if (areViewportsHidden) { + console.warn('Ignoring resize when viewports have size 0'); + return; + } + // if there is a grid resize happening, it means the viewport grid // has been manipulated (e.g., panels closed, added, etc.) and we need // to resize all viewports, so we will add a timeout here to make sure diff --git a/platform/app/cypress/support/commands.js b/platform/app/cypress/support/commands.js index 5df25e108df..7e8f912c9d8 100644 --- a/platform/app/cypress/support/commands.js +++ b/platform/app/cypress/support/commands.js @@ -107,7 +107,7 @@ Cypress.Commands.add('isPageLoaded', (url = '/basic-test') => { Cypress.Commands.add('openStudyList', () => { cy.initRouteAliases(); - cy.visit('/', { timeout: 15000 }); + cy.visit('/', { timeout: 30000 }); // For some reason cypress 12.x does not like to stub the network request // so we just wait here for querying to be done. diff --git a/platform/app/src/components/ViewportGrid.tsx b/platform/app/src/components/ViewportGrid.tsx index 0d41892e37a..0c0f3794786 100644 --- a/platform/app/src/components/ViewportGrid.tsx +++ b/platform/app/src/components/ViewportGrid.tsx @@ -292,7 +292,7 @@ function ViewerViewportGrid(props: withAppTypes) { >
- {title} + +
{title}
+ +
+ {subtitle}
- +
-
- -
-

{t('Context')}: {context} diff --git a/version.txt b/version.txt index 33f465d1ad3..2009c7dfad9 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -3.9.1 \ No newline at end of file +3.9.2 diff --git a/yarn.lock b/yarn.lock index 4284680a763..737d8ac837a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4006,28 +4006,6 @@ resolved "https://registry.yarnpkg.com/@juggle/resize-observer/-/resize-observer-3.4.0.tgz#08d6c5e20cf7e4cc02fd181c4b0c225cd31dbb60" integrity sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA== -"@kitware/vtk.js@32.1.0": - version "32.1.0" - resolved "https://registry.yarnpkg.com/@kitware/vtk.js/-/vtk.js-32.1.0.tgz#db46655633b9ce8ef93a6df736fd6ee55395350f" - integrity sha512-lVLOwZtQPHCJnZ2WDXSPF8yIaGBYw97YUNFAKnQszk6G2OrHvoir3jHdUgE/Vmw0VpoXwngWumY7JY52BwXzew== - dependencies: - "@babel/runtime" "7.22.11" - "@types/webxr" "^0.5.5" - commander "9.2.0" - d3-scale "4.0.2" - fast-deep-equal "^3.1.3" - fflate "0.7.3" - gl-matrix "3.4.3" - globalthis "1.0.3" - seedrandom "3.0.5" - shader-loader "1.3.1" - shelljs "0.8.5" - spark-md5 "3.0.2" - stream-browserify "3.0.0" - webworker-promise "0.5.0" - worker-loader "3.0.8" - xmlbuilder2 "3.0.2" - "@kitware/vtk.js@32.1.1": version "32.1.1" resolved "https://registry.yarnpkg.com/@kitware/vtk.js/-/vtk.js-32.1.1.tgz#20179cb5f65f33dea4626a948afe24eb16364f8a"