Skip to content

Commit

Permalink
Map facets to filters when adding them to persisted filters from URL
Browse files Browse the repository at this point in the history
The values we were using before aren't valid anymore, because the
FBI spec changed all the enum values to be IN CAPS, and simple search
filters don't accept that.
  • Loading branch information
Adamik10 committed Oct 14, 2024
1 parent 5c80801 commit 6c2e9c4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/apps/search-result/useFilterHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
setQueryParametersInUrl
} from "../../core/utils/helpers/url";
import { FacetFieldEnum } from "../../core/dbc-gateway/generated/graphql";
import { mapFacetToFilter } from "./helper";

const useFilterHandler = () => {
const dispatch = useDispatch();
Expand Down Expand Up @@ -43,11 +44,11 @@ const useFilterHandler = () => {
);

const addFilterFromUrlParamListener = (facet: FacetFieldEnum) => {
const urlFilter = getUrlQueryParam(facet);
const urlFilter = getUrlQueryParam(mapFacetToFilter(facet));
if (urlFilter) {
// We only use term from the url, therefore key is not important here.
addToFilter({
facet,
facet: mapFacetToFilter(facet),
term: { key: "key", term: urlFilter }
});
}
Expand Down

0 comments on commit 6c2e9c4

Please sign in to comment.