fix(URL): allow multi filter query (#3314)
This commit is contained in:
parent
25b4f8ed97
commit
45a34ae0fe
@ -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 };
|
||||
|
||||
@ -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) };
|
||||
}
|
||||
},
|
||||
{}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user