Skip to content

Commit

Permalink
Merge pull request #1050 from danskernesdigitalebibliotek/fix/autosug…
Browse files Browse the repository at this point in the history
…gest-with-filters

Fix/autosuggest with filters
  • Loading branch information
Adamik10 authored Apr 2, 2024
2 parents db7b9ce + d4c229a commit 11987cd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/apps/search-header/search-header.entry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { withUrls } from "../../core/utils/url";
import SearchHeader from "./search-header";
import GlobalUrlEntryPropsInterface from "../../core/utils/types/global-url-props";
import { GlobalEntryTextProps } from "../../core/storybook/globalTextArgs";
import { GlobalConfigProps } from "../../core/storybook/globalConfigArgs";

export interface SearchHeaderTextProps {
searchHeaderIconAltText?: string;
Expand All @@ -30,6 +31,7 @@ export interface SearchHeaderTextProps {
export interface SearchHeaderEntryProps
extends SearchHeaderTextProps,
GlobalEntryTextProps,
GlobalConfigProps,
GlobalUrlEntryPropsInterface {}

const SearchHeaderEntry: React.FC<SearchHeaderEntryProps> = () => {
Expand Down
8 changes: 4 additions & 4 deletions src/apps/search-header/search-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ const SearchHeader: React.FC = () => {
{
render: t("autosuggestBookCategoryText"),
term: AutosuggestCategory.book,
facet: "materialTypes"
facet: "materialTypesSpecific"
},
{
render: t("autosuggestEbookCategoryText"),
term: AutosuggestCategory.ebook,
facet: "materialTypes"
facet: "materialTypesSpecific"
},
{
render: t("autosuggestFilmCategoryText"),
Expand All @@ -80,7 +80,7 @@ const SearchHeader: React.FC = () => {
{
render: t("autosuggestAudioBookCategoryText"),
term: AutosuggestCategory.audioBook,
facet: "materialTypes"
facet: "materialTypesSpecific"
},
{
render: t("autosuggestMusicCategoryText"),
Expand All @@ -95,7 +95,7 @@ const SearchHeader: React.FC = () => {
{
render: t("autosuggestAnimatedSeriesCategoryText"),
term: AutosuggestCategory.animatedSeries,
facet: "materialTypes"
facet: "materialTypesSpecific"
}
];
// Once we register the item select event the original highlighted index is
Expand Down
4 changes: 1 addition & 3 deletions src/apps/search-result/search-result.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ const SearchResult: React.FC<SearchResultProps> = ({ q, pageSize }) => {
useEffect(() => {
addFilterFromUrlParamListener(FacetField.MaterialTypesSpecific);
addFilterFromUrlParamListener(FacetField.WorkTypes);
// We only want to do this once, so we need the dependency array empty
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}, [addFilterFromUrlParamListener]);

const { data, isLoading } = useSearchWithPaginationQuery({
q: { all: q },
Expand Down
2 changes: 1 addition & 1 deletion src/core/utils/types/material-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const enum AutosuggestCategory {
animatedSeries = "tegneserie"
}

export type AutosuggestCategoryFacet = "materialTypes" | "workTypes";
export type AutosuggestCategoryFacet = "materialTypesSpecific" | "workTypes";

export type AutosuggestCategoryList = {
render: string;
Expand Down

0 comments on commit 11987cd

Please sign in to comment.