diff --git a/front/packages/ui/src/search/index.tsx b/front/packages/ui/src/search/index.tsx index 10fe1171..0230ae62 100644 --- a/front/packages/ui/src/search/index.tsx +++ b/front/packages/ui/src/search/index.tsx @@ -19,6 +19,7 @@ */ import { LibraryItem, LibraryItemP, QueryIdentifier, QueryPage } from "@kyoo/models"; +import { P } from "@kyoo/primitives"; import { Suspense, useRef, useDeferredValue } from "react"; import { useTranslation } from "react-i18next"; import { ItemGrid } from "../browse/grid"; @@ -27,16 +28,6 @@ import { EmptyView } from "../fetch"; import { InfiniteFetch } from "../fetch-infinite"; import { DefaultLayout } from "../layout"; -const useIsFirstRender = () => { - const isFirst = useRef(true); - - if (isFirst.current) { - isFirst.current = false; - return true; - } - return false; -}; - const query = (query: string): QueryIdentifier => ({ parser: LibraryItemP, path: ["search", query, "items"], @@ -45,24 +36,21 @@ const query = (query: string): QueryIdentifier => ({ }); export const SearchPage: QueryPage<{ q?: string }> = ({ q }) => { - const deferredQuery = useDeferredValue(q); const { t } = useTranslation(); - const isFirst = useIsFirstRender(); const empty = ; - if (!deferredQuery) return empty; + if (!q) return empty; return ( - - - {(item) => } - - + + {(item) => } + ); };