Compare commits

..
Author SHA1 Message Date
ohif-bot 9c1a3c3183 chore(release): publish [skip ci]
- @ohif/extension-vtk@0.52.31
 - @ohif/core@1.6.2
 - @ohif/ui@0.59.1
 - @ohif/viewer@2.4.1
2019-11-05 20:01:36 +00:00
Emanuel Fiuza de Oliveira ecaf578f92 fix: #1075 Returning to the Study List before all series have finishe… (#1090)
* fix: #1075 Returning to the Study List before all series have finished loading throws multiple errors in console

* fix: 🐛 Addressing review feedback from issue #1075

Adding support for cancelable pattern

Closes: #1075

* fix: 🐛 update unit test for exports

Closes: #1075
2019-11-05 16:47:54 -03:00
13 changed files with 127 additions and 15 deletions

No files matched your search

+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [0.52.31](https://github.com/OHIF/Viewers/compare/@ohif/extension-vtk@0.52.30...@ohif/extension-vtk@0.52.31) (2019-11-05)
**Note:** Version bump only for package @ohif/extension-vtk
## [0.52.30](https://github.com/OHIF/Viewers/compare/@ohif/extension-vtk@0.52.29...@ohif/extension-vtk@0.52.30) (2019-11-04)
**Note:** Version bump only for package @ohif/extension-vtk
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-vtk",
"version": "0.52.30",
"version": "0.52.31",
"description": "OHIF extension for VTK.js",
"author": "OHIF",
"license": "MIT",
@@ -52,8 +52,8 @@
"react-vtkjs-viewport": "^0.3.9"
},
"devDependencies": {
"@ohif/core": "^1.6.1",
"@ohif/ui": "^0.59.0",
"@ohif/core": "^1.6.2",
"@ohif/ui": "^0.59.1",
"cornerstone-tools": "^4.0.9",
"cornerstone-wado-image-loader": "^3.0.0",
"dcmjs": "^0.6.1",
+11
View File
@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.6.2](https://github.com/OHIF/Viewers/compare/@ohif/core@1.6.1...@ohif/core@1.6.2) (2019-11-05)
### Bug Fixes
* [#1075](https://github.com/OHIF/Viewers/issues/1075) Returning to the Study List before all series have finishe… ([#1090](https://github.com/OHIF/Viewers/issues/1090)) ([ecaf578](https://github.com/OHIF/Viewers/commit/ecaf578f92dc40294cec7ff9b272fb432dec4125))
## [1.6.1](https://github.com/OHIF/Viewers/compare/@ohif/core@1.6.0...@ohif/core@1.6.1) (2019-10-31)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/core",
"version": "1.6.1",
"version": "1.6.2",
"description": "Generic business logic for web-based medical imaging applications",
"author": "OHIF Core Team",
"license": "MIT",
+3
View File
@@ -11,6 +11,7 @@ import writeScript from './writeScript.js';
import DicomLoaderService from './dicomLoaderService.js';
import b64toBlob from './b64toBlob.js';
import * as urlUtil from './urlUtil';
import makeCancelable from './makeCancelable';
const utils = {
guid,
@@ -27,6 +28,7 @@ const utils = {
DICOMTagDescriptions,
DicomLoaderService,
urlUtil,
makeCancelable,
};
export {
@@ -44,6 +46,7 @@ export {
DICOMTagDescriptions,
DicomLoaderService,
urlUtil,
makeCancelable,
};
export default utils;
+1
View File
@@ -17,6 +17,7 @@ describe('Top level exports', () => {
'DICOMTagDescriptions',
'DicomLoaderService',
'urlUtil',
'makeCancelable',
].sort();
const exports = Object.keys(utils.default).sort();
+19
View File
@@ -0,0 +1,19 @@
export default function makeCancelable(thenable) {
let isCanceled = false;
const promise = Promise.resolve(thenable).then(
function(result) {
if (isCanceled) throw Object.freeze({ isCanceled });
return result;
},
function(error) {
if (isCanceled) throw Object.freeze({ isCanceled, error });
throw error;
}
);
return Object.assign(Object.create(promise), {
then: promise.then.bind(promise),
cancel() {
isCanceled = true;
},
});
}
+11
View File
@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [0.59.1](https://github.com/OHIF/Viewers/compare/@ohif/ui@0.59.0...@ohif/ui@0.59.1) (2019-11-05)
### Bug Fixes
* [#1075](https://github.com/OHIF/Viewers/issues/1075) Returning to the Study List before all series have finishe… ([#1090](https://github.com/OHIF/Viewers/issues/1090)) ([ecaf578](https://github.com/OHIF/Viewers/commit/ecaf578f92dc40294cec7ff9b272fb432dec4125))
# [0.59.0](https://github.com/OHIF/Viewers/compare/@ohif/ui@0.58.5...@ohif/ui@0.59.0) (2019-11-04)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/ui",
"version": "0.59.0",
"version": "0.59.1",
"description": "A set of React components for Medical Imaging Viewers",
"author": "OHIF Contributors",
"license": "MIT",
@@ -1,6 +1,7 @@
/* global cornerstone */
import './ImageThumbnail.styl';
import { utils } from '@ohif/core';
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
@@ -32,7 +33,7 @@ export default class ImageThumbnail extends PureComponent {
constructor(props) {
super(props);
this.cancelablePromises = [];
this.canvas = React.createRef();
this.state = {
loading: this.shouldRenderToCanvas(),
@@ -43,10 +44,17 @@ export default class ImageThumbnail extends PureComponent {
return this.props.imageId && !this.props.imageSrc;
}
fetchImage() {
const cancelablePromise = utils.makeCancelable(
cornerstone.loadAndCacheImage(this.props.imageId)
);
this.cancelablePromises.push(cancelablePromise);
return cancelablePromise;
}
componentDidMount() {
if (this.shouldRenderToCanvas()) {
cornerstone
.loadAndCacheImage(this.props.imageId)
this.fetchImage()
.then(image => {
cornerstone.renderToCanvas(this.canvas.current, image);
this.setState({
@@ -54,6 +62,7 @@ export default class ImageThumbnail extends PureComponent {
});
})
.catch(error => {
if (error.isCanceled) return;
this.setState({
loading: false,
error: true,
@@ -63,6 +72,12 @@ export default class ImageThumbnail extends PureComponent {
}
}
componentWillUnmount() {
while (this.cancelablePromises.length > 0) {
this.cancelablePromises.pop().cancel();
}
}
render() {
let loadingOrError;
if (this.props.error) {
+11
View File
@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.4.1](https://github.com/OHIF/Viewers/compare/@ohif/viewer@2.4.0...@ohif/viewer@2.4.1) (2019-11-05)
### Bug Fixes
* [#1075](https://github.com/OHIF/Viewers/issues/1075) Returning to the Study List before all series have finishe… ([#1090](https://github.com/OHIF/Viewers/issues/1090)) ([ecaf578](https://github.com/OHIF/Viewers/commit/ecaf578f92dc40294cec7ff9b272fb432dec4125))
# [2.4.0](https://github.com/OHIF/Viewers/compare/@ohif/viewer@2.3.8...@ohif/viewer@2.4.0) (2019-11-04)
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/viewer",
"version": "2.4.0",
"version": "2.4.1",
"description": "OHIF Viewer",
"author": "OHIF Contributors",
"license": "MIT",
@@ -45,14 +45,14 @@
},
"dependencies": {
"@babel/runtime": "^7.5.5",
"@ohif/core": "^1.6.1",
"@ohif/core": "^1.6.2",
"@ohif/extension-cornerstone": "^2.0.0",
"@ohif/extension-dicom-html": "^1.0.1",
"@ohif/extension-dicom-microscopy": "^0.50.6",
"@ohif/extension-dicom-pdf": "^1.0.0",
"@ohif/extension-vtk": "^0.52.30",
"@ohif/extension-vtk": "^0.52.31",
"@ohif/i18n": "^0.51.0",
"@ohif/ui": "^0.59.0",
"@ohif/ui": "^0.59.1",
"@tanem/react-nprogress": "^1.1.25",
"classnames": "^2.2.6",
"core-js": "^3.2.1",
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
import { extensionManager } from './../App.js';
const { OHIFStudyMetadata, OHIFSeriesMetadata } = metadata;
const { retrieveStudiesMetadata } = studies;
const { retrieveStudiesMetadata, deleteStudyMetadataPromise } = studies;
const { studyMetadataManager, updateMetaDataManager } = utils;
class ViewerRetrieveStudyData extends Component {
@@ -18,6 +18,8 @@ class ViewerRetrieveStudyData extends Component {
constructor(props) {
super(props);
this.abortSeriesLoad = false;
this.seriesLoadStats = Object.create(null);
this.state = {
studies: null,
error: null,
@@ -83,18 +85,49 @@ class ViewerRetrieveStudyData extends Component {
});
}
_handleSeriesLoadResult(error, studyMetadata, series) {
if (this.abortSeriesLoad) return;
const stats = this.seriesLoadStats[studyMetadata.getStudyInstanceUID()];
if (!stats) return;
stats.count--;
if (error || !series) {
stats.errors++;
log.error(error || 'Bad Series');
return;
}
this._addSeriesToStudy(studyMetadata, series);
}
_attemptToLoadRemainingSeries(studyMetadata) {
const { seriesLoader } = studyMetadata.getData();
if (!seriesLoader) {
return;
}
const stats = (this.seriesLoadStats[studyMetadata.getStudyInstanceUID()] = {
errors: 0,
count: 0,
});
while (seriesLoader.hasNext()) {
seriesLoader
.next()
.then(
series => void this._addSeriesToStudy(studyMetadata, series),
error => void log.error(error)
series =>
void this._handleSeriesLoadResult(null, studyMetadata, series),
error => void this._handleSeriesLoadResult({ error }, null, null)
);
stats.count++;
}
}
componentWillUnmount() {
this.abortSeriesLoad = true;
for (const studyInstanceUid in this.seriesLoadStats) {
const stats = this.seriesLoadStats[studyInstanceUid];
if (stats && (stats.count > 0 || stats.errors > 0)) {
deleteStudyMetadataPromise(studyInstanceUid);
studyMetadataManager.remove(studyInstanceUid);
log.info(`Purging incomplete study data: ${studyInstanceUid}`);
}
}
}