fix(URL): allow multi filter query (#3314)

This commit is contained in:
Bill Wallace 2023-04-05 16:37:37 -04:00 committed by GitHub
parent 25b4f8ed97
commit 45a34ae0fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View File

@ -21,11 +21,11 @@ const getSplitParam = (
lowerCaseKey: string,
params = new URLSearchParams(window.location.search)
): string[] => {
return splitComma(
[...params]
.find(([key, value]) => key.toLowerCase() === lowerCaseKey && value)
?.slice?.(1)
const sourceKey = [...params.keys()].find(
it => it.toLowerCase() === lowerCaseKey
);
if (!sourceKey) return;
return splitComma(params.getAll(sourceKey));
};
export { splitComma, getSplitParam };

View File

@ -1,15 +1,16 @@
import React, { useEffect, useState, useRef } from 'react';
import { useParams, useLocation } from 'react-router';
import PropTypes from 'prop-types';
// TODO: DicomMetadataStore should be injected?
import { DicomMetadataStore, ServicesManager } from '@ohif/core';
import { DicomMetadataStore, ServicesManager, utils } from '@ohif/core';
import { DragAndDropProvider, ImageViewerProvider } from '@ohif/ui';
import { useQuery, useSearchParams } from '@hooks';
import ViewportGrid from '@components/ViewportGrid';
import Compose from './Compose';
import getStudies from './studiesList';
const { getSplitParam } = utils;
/**
* Initialize the route.
*
@ -283,13 +284,14 @@ export default function ModeRoute({
if (lowerVal !== 'studyinstanceuids') {
// Not sure why the case matters here - it doesn't in the URL
if (lowerVal === 'seriesinstanceuid') {
const seriesUIDs = getSplitParam(lowerVal, query);
return {
...acc,
seriesInstanceUID: query.get(val),
seriesInstanceUID: seriesUIDs,
};
}
return { ...acc, [val]: query.get(val) };
return { ...acc, [val]: getSplitParam(lowerVal, query) };
}
},
{}