From 7ebe0adacedf9e08e0e7f28bb8199541c460622a Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Tue, 4 Apr 2023 20:33:03 +0900 Subject: [PATCH] Disable deferred queries for the search as it does not work --- front/packages/ui/src/search/index.tsx | 36 +++++++++----------------- 1 file changed, 12 insertions(+), 24 deletions(-) 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) => } + ); };