fix(thumbnail): Avoid multiple promise creations for thumbnails (#3756)

This commit is contained in:
Joe Boccanfuso 2023-11-02 12:07:52 -04:00 committed by GitHub
parent 09ff293f5f
commit b23eeff937
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 6 deletions

View File

@ -423,6 +423,9 @@ function createDicomWebApi(dicomWebConfig, userAuthenticationService) {
function setSuccessFlag() {
const study = DicomMetadataStore.getStudy(StudyInstanceUID, madeInClient);
if (!study) {
return;
}
study.isLoaded = true;
}

View File

@ -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

View File

@ -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

View File

@ -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)');

View File

@ -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) {

View File

@ -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) {