From 7d5670e6703006558c71f7f8aedcdcede067e44c Mon Sep 17 00:00:00 2001 From: NicoSerranoP Date: Tue, 10 Dec 2024 23:51:24 -0500 Subject: [PATCH] fix(search): useDeferredValue to lag behind on search --- .../interface/src/features/rounds/components/Projects.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/interface/src/features/rounds/components/Projects.tsx b/packages/interface/src/features/rounds/components/Projects.tsx index ca212d3c..aa528a62 100644 --- a/packages/interface/src/features/rounds/components/Projects.tsx +++ b/packages/interface/src/features/rounds/components/Projects.tsx @@ -1,6 +1,6 @@ import clsx from "clsx"; import Link from "next/link"; -import { useCallback, useMemo, useState } from "react"; +import { useCallback, useDeferredValue, useMemo, useState } from "react"; import { FiAlertCircle } from "react-icons/fi"; import { Hex, zeroAddress } from "viem"; @@ -26,6 +26,7 @@ export interface IProjectsProps { export const Projects = ({ pollId = "" }: IProjectsProps): JSX.Element => { const [searchTerm, setSearchTerm] = useState(""); + const deferredSearchTerm = useDeferredValue(searchTerm); const roundState = useRoundState({ pollId }); @@ -34,7 +35,7 @@ export const Projects = ({ pollId = "" }: IProjectsProps): JSX.Element => { const projects = useSearchProjects({ pollId, - search: searchTerm, + search: deferredSearchTerm, registryAddress: round?.registryAddress ?? zeroAddress, });