From 0558cc48bcd6844ae274996d46dbf00e173f60f1 Mon Sep 17 00:00:00 2001 From: Adam Antal Date: Fri, 22 Mar 2024 11:46:27 +0100 Subject: [PATCH 1/3] Correct materialTypes to materialTypesSpecific in search header This key has changed in the specs for the FBI API a while back. --- src/apps/search-header/search-header.tsx | 8 ++++---- src/core/utils/types/material-type.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/apps/search-header/search-header.tsx b/src/apps/search-header/search-header.tsx index 1dcb4ef658..1caf8ead91 100644 --- a/src/apps/search-header/search-header.tsx +++ b/src/apps/search-header/search-header.tsx @@ -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"), @@ -80,7 +80,7 @@ const SearchHeader: React.FC = () => { { render: t("autosuggestAudioBookCategoryText"), term: AutosuggestCategory.audioBook, - facet: "materialTypes" + facet: "materialTypesSpecific" }, { render: t("autosuggestMusicCategoryText"), @@ -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 diff --git a/src/core/utils/types/material-type.ts b/src/core/utils/types/material-type.ts index 7c19ee8c0a..90cea89a5b 100644 --- a/src/core/utils/types/material-type.ts +++ b/src/core/utils/types/material-type.ts @@ -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; From ecf7ca99b44a329565f66aee0b3544fbbe1cc2bf Mon Sep 17 00:00:00 2001 From: Adam Antal Date: Fri, 22 Mar 2024 11:48:33 +0100 Subject: [PATCH 2/3] Get rid of obsolete eslint-disable-next-line in search-result We were using this eslint-disable to only use a useEffect once - on load. We achieve the same by adding the function used inside the useEffect. --- src/apps/search-result/search-result.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/apps/search-result/search-result.tsx b/src/apps/search-result/search-result.tsx index 41ff0ba1c8..e83aec2a6e 100644 --- a/src/apps/search-result/search-result.tsx +++ b/src/apps/search-result/search-result.tsx @@ -90,9 +90,7 @@ const SearchResult: React.FC = ({ 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 }, From d4c229ad5af79328ccf6c09468d67ac395f66e7c Mon Sep 17 00:00:00 2001 From: Adam Antal Date: Fri, 22 Mar 2024 11:53:05 +0100 Subject: [PATCH 3/3] Add GlobalConfigProps into the search header entry Because the app should expect it - like every other app, because it's a global config. --- src/apps/search-header/search-header.entry.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/apps/search-header/search-header.entry.tsx b/src/apps/search-header/search-header.entry.tsx index 9d7ff7e09c..f86f4a7a8d 100644 --- a/src/apps/search-header/search-header.entry.tsx +++ b/src/apps/search-header/search-header.entry.tsx @@ -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; @@ -30,6 +31,7 @@ export interface SearchHeaderTextProps { export interface SearchHeaderEntryProps extends SearchHeaderTextProps, GlobalEntryTextProps, + GlobalConfigProps, GlobalUrlEntryPropsInterface {} const SearchHeaderEntry: React.FC = () => {