fix: 🐛 Dismiss all dialogs if leaving viewer route #1242 (#1301)

* fix: 🐛 #1242

Dismiss all dialogs if route change

Closes: #1242

* CR Update: Dismiss dialogs in videwer
This commit is contained in:
Igor Octaviano 2019-12-16 15:26:31 -03:00 committed by Danny Brown
parent 8bbbf3a889
commit 5c3d8b37b6

View File

@ -4,6 +4,7 @@ import classNames from 'classnames';
import { MODULE_TYPES } from '@ohif/core';
import OHIF from '@ohif/core';
import { withDialog } from '@ohif/ui';
import moment from 'moment';
import ConnectedHeader from './ConnectedHeader.js';
import ConnectedToolbarRow from './ConnectedToolbarRow.js';
@ -69,6 +70,7 @@ class Viewer extends Component {
// window.store.getState().viewports.activeViewportIndex
activeViewportIndex: PropTypes.number.isRequired,
isStudyLoaded: PropTypes.bool,
dialog: PropTypes.object,
};
constructor(props) {
@ -104,6 +106,12 @@ class Viewer extends Component {
thumbnails: [],
};
componentWillUnmount() {
if (this.props.dialog) {
this.props.dialog.dismissAll();
}
}
retrieveTimepoints = filter => {
OHIF.log.info('retrieveTimepoints');
@ -297,11 +305,11 @@ class Viewer extends Component {
activeIndex={this.props.activeViewportIndex}
/>
) : (
<ConnectedStudyBrowser
studies={this.state.thumbnails}
studyMetadata={this.props.studies}
/>
)}
<ConnectedStudyBrowser
studies={this.state.thumbnails}
studyMetadata={this.props.studies}
/>
)}
</SidePanel>
{/* MAIN */}
@ -324,7 +332,7 @@ class Viewer extends Component {
}
}
export default Viewer;
export default withDialog(Viewer);
/**
* What types are these? Why do we have "mapping" dropped in here instead of in
@ -337,7 +345,7 @@ export default Viewer;
* @param {Study[]} studies
* @param {DisplaySet[]} studies[].displaySets
*/
const _mapStudiesToThumbnails = function (studies) {
const _mapStudiesToThumbnails = function(studies) {
return studies.map(study => {
const { studyInstanceUid } = study;