diff --git a/extensions/default/src/DicomWebDataSource/index.js b/extensions/default/src/DicomWebDataSource/index.js index b265e4a07a9..679e552c1b2 100644 --- a/extensions/default/src/DicomWebDataSource/index.js +++ b/extensions/default/src/DicomWebDataSource/index.js @@ -423,6 +423,9 @@ function createDicomWebApi(dicomWebConfig, userAuthenticationService) { function setSuccessFlag() { const study = DicomMetadataStore.getStudy(StudyInstanceUID, madeInClient); + if (!study) { + return; + } study.isLoaded = true; } diff --git a/extensions/default/src/Panels/WrappedPanelStudyBrowser.tsx b/extensions/default/src/Panels/WrappedPanelStudyBrowser.tsx index a1852046c50..9be92e25ed0 100644 --- a/extensions/default/src/Panels/WrappedPanelStudyBrowser.tsx +++ b/extensions/default/src/Panels/WrappedPanelStudyBrowser.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useCallback } from 'react'; import PropTypes from 'prop-types'; // import PanelStudyBrowser from './PanelStudyBrowser'; @@ -18,7 +18,10 @@ function WrappedPanelStudyBrowser({ commandsManager, extensionManager, servicesM // already determined our datasource const dataSource = extensionManager.getDataSources()[0]; const _getStudiesForPatientByMRN = getStudiesForPatientByMRN.bind(null, dataSource); - const _getImageSrcFromImageId = _createGetImageSrcFromImageIdFn(extensionManager); + const _getImageSrcFromImageId = useCallback( + _createGetImageSrcFromImageIdFn(extensionManager), + [] + ); const _requestDisplaySetCreationForStudy = requestDisplaySetCreationForStudy.bind( null, dataSource diff --git a/extensions/measurement-tracking/src/panels/PanelStudyBrowserTracking/index.tsx b/extensions/measurement-tracking/src/panels/PanelStudyBrowserTracking/index.tsx index 3ce336cd4e4..cffd41bb075 100644 --- a/extensions/measurement-tracking/src/panels/PanelStudyBrowserTracking/index.tsx +++ b/extensions/measurement-tracking/src/panels/PanelStudyBrowserTracking/index.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useCallback } from 'react'; import PropTypes from 'prop-types'; // import PanelStudyBrowserTracking from './PanelStudyBrowserTracking'; @@ -26,7 +26,10 @@ function WrappedPanelStudyBrowserTracking({ commandsManager, extensionManager, s const getStudiesForPatientByMRN = _getStudyForPatientUtility(extensionManager); const _getStudiesForPatientByMRN = getStudiesForPatientByMRN.bind(null, dataSource); - const _getImageSrcFromImageId = _createGetImageSrcFromImageIdFn(extensionManager); + const _getImageSrcFromImageId = useCallback( + _createGetImageSrcFromImageIdFn(extensionManager), + [] + ); const _requestDisplaySetCreationForStudy = requestDisplaySetCreationForStudy.bind( null, dataSource diff --git a/platform/app/cypress/integration/measurement-tracking/OHIFCornerstoneToolbar.spec.js b/platform/app/cypress/integration/measurement-tracking/OHIFCornerstoneToolbar.spec.js index e0c509b972e..d6a7bb24d2a 100644 --- a/platform/app/cypress/integration/measurement-tracking/OHIFCornerstoneToolbar.spec.js +++ b/platform/app/cypress/integration/measurement-tracking/OHIFCornerstoneToolbar.spec.js @@ -442,7 +442,18 @@ describe('OHIF Cornerstone Toolbar', () => { cy.waitDicomImage(); // Now navigate down once and check that the left hand pane navigated - cy.get('body').type('{downarrow}'); + cy.get('body').focus().type('{downarrow}'); + + // The following lines assist in troubleshooting when/if this test were to fail. + cy.get('[data-cy="viewport-pane"]') + .eq(0) + .find('[data-cy="viewport-overlay-top-right"]') + .should('contains.text', 'I:2 (2/20)'); + cy.get('[data-cy="viewport-pane"]') + .eq(1) + .find('[data-cy="viewport-overlay-top-right"]') + .should('contains.text', 'I:2 (2/20)'); + cy.get('body').type('{leftarrow}'); cy.setLayout(1, 1); cy.get('@viewportInfoTopRight').should('contains.text', 'I:2 (2/20)'); diff --git a/platform/app/cypress/support/commands.js b/platform/app/cypress/support/commands.js index f1351eb0d64..58bcd192d5c 100644 --- a/platform/app/cypress/support/commands.js +++ b/platform/app/cypress/support/commands.js @@ -181,7 +181,7 @@ Cypress.Commands.add('expectMinimumThumbnails', (seriesToWait = 1) => { //Command to wait DICOM image to load into the viewport Cypress.Commands.add('waitDicomImage', (mode = '/basic-test', timeout = 50000) => { cy.window() - .its('cornerstone') + .its('cornerstone', { timeout: 30000 }) .should($cornerstone => { const enabled = $cornerstone.getEnabledElements(); if (enabled?.length) { diff --git a/platform/core/src/services/DicomMetadataStore/DicomMetadataStore.ts b/platform/core/src/services/DicomMetadataStore/DicomMetadataStore.ts index 841e72e26c1..8aef17ef330 100644 --- a/platform/core/src/services/DicomMetadataStore/DicomMetadataStore.ts +++ b/platform/core/src/services/DicomMetadataStore/DicomMetadataStore.ts @@ -187,6 +187,10 @@ const BaseImplementation = { }); }, addSeriesMetadata(seriesSummaryMetadata, madeInClient = false) { + if (!seriesSummaryMetadata || !seriesSummaryMetadata.length || !seriesSummaryMetadata[0]) { + return; + } + const { StudyInstanceUID } = seriesSummaryMetadata[0]; let study = _getStudy(StudyInstanceUID); if (!study) {