fix(Browser history): fixed NPE when navigating a study via browser history and history navigation is now available via the navigateHistory command (#3337)

* fix(Browser history):
- fixed an NPE when navigating to a different study via the URL
- exposed browser history navigation via a command

* Added documentation for the navigateHistory command.
Moved the history object from UI to viewer.
This commit is contained in:
Joe Boccanfuso authored and GitHub committed 2023-04-27 10:46:23 -04:00
1 parent eea0ed487b
commit 51cb0519fc
7 files changed
+88 -1

No files matched your search

+5 -1
View File
@@ -1,5 +1,5 @@
import React, { useEffect, useState, useRef } from 'react';
import { useParams, useLocation } from 'react-router';
import { useParams, useLocation, useNavigate } from 'react-router';
import PropTypes from 'prop-types';
// TODO: DicomMetadataStore should be injected?
import { DicomMetadataStore, ServicesManager, utils } from '@ohif/core';
@@ -8,6 +8,7 @@ import { useQuery, useSearchParams } from '@hooks';
import ViewportGrid from '@components/ViewportGrid';
import Compose from './Compose';
import getStudies from './studiesList';
import { history } from '../../utils/history';
const { getSplitParam } = utils;
@@ -105,6 +106,9 @@ export default function ModeRoute({
const locationRef = useRef(null);
const isMounted = useRef(false);
// Expose the react router dom navigation.
history.navigate = useNavigate();
if (location !== locationRef.current) {
layoutTemplateData.current = null;
locationRef.current = location;