From e1cc8adbad86f59a958e8ff609ee2b8eb21d1d5b Mon Sep 17 00:00:00 2001 From: "Emanuel F. Oliveira" Date: Thu, 23 Feb 2017 10:57:17 -0300 Subject: [PATCH] Adapting OHIFStudyMetadataSource to use new retrieveMetadata call from ohif:study-list package. --- .../ohif-study-list/client/lib/OHIFStudyMetadataSource.js | 4 +--- Packages/ohif-study-list/client/lib/retrieveStudyMetadata.js | 5 +++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Packages/ohif-study-list/client/lib/OHIFStudyMetadataSource.js b/Packages/ohif-study-list/client/lib/OHIFStudyMetadataSource.js index c01e88b61..22baafd2e 100644 --- a/Packages/ohif-study-list/client/lib/OHIFStudyMetadataSource.js +++ b/Packages/ohif-study-list/client/lib/OHIFStudyMetadataSource.js @@ -13,9 +13,7 @@ export class OHIFStudyMetadataSource extends OHIF.viewerbase.StudyMetadataSource * @return {Promise} A Promise object */ getByInstanceUID(studyInstanceUID) { - return new Promise((resolve, reject) => { - getStudyMetadata(studyInstanceUID, resolve, reject); - }); + return OHIF.studylist.retrieveStudyMetadata(studyInstanceUID); } /** diff --git a/Packages/ohif-study-list/client/lib/retrieveStudyMetadata.js b/Packages/ohif-study-list/client/lib/retrieveStudyMetadata.js index f5d422479..d09455555 100644 --- a/Packages/ohif-study-list/client/lib/retrieveStudyMetadata.js +++ b/Packages/ohif-study-list/client/lib/retrieveStudyMetadata.js @@ -13,6 +13,11 @@ const StudyMetaDataPromises = new Map(); * @returns {Promise} that will be resolved with the metadata or rejected with the error */ OHIF.studylist.retrieveStudyMetadata = studyInstanceUid => { + + // @TODO: Whenever a study metadata request has failed, its related promise will be rejected once and for all + // and further requests for that metadata will always fail. On failure, we probably need to remove the + // corresponding promise from the "StudyMetaDataPromises" map... + // If the StudyMetaDataPromises cache already has a pending or resolved promise related to the // given studyInstanceUid, then that promise is returned if (StudyMetaDataPromises.has(studyInstanceUid)) {