Unverified Commit 81bc53f9 authored by Imran Salam's avatar Imran Salam Committed by GitHub
Browse files

Fix invalid query param breaking Entity Viewer (#564)

parent 1967b77f
Pipeline #189617 passed with stages
in 8 minutes and 58 seconds
...@@ -345,6 +345,9 @@ const GeneViewWithData = (props: GeneViewWithDataProps) => { ...@@ -345,6 +345,9 @@ const GeneViewWithData = (props: GeneViewWithDataProps) => {
); );
}; };
const isViewParameterValid = (view: string) =>
Object.values(View).some((value) => value === view);
const useGeneViewRouting = () => { const useGeneViewRouting = () => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const params: { [key: string]: string } = useParams(); const params: { [key: string]: string } = useParams();
...@@ -361,7 +364,7 @@ const useGeneViewRouting = () => { ...@@ -361,7 +364,7 @@ const useGeneViewRouting = () => {
const selectedTabs = useSelector(getSelectedGeneViewTabs); const selectedTabs = useSelector(getSelectedGeneViewTabs);
useEffect(() => { useEffect(() => {
if (view && viewInRedux !== view) { if (view && isViewParameterValid(view) && viewInRedux !== view) {
dispatch(updateView(view as View)); dispatch(updateView(view as View));
} else { } else {
const url = urlFor.entityViewer({ const url = urlFor.entityViewer({
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment