Skip to content

Commit

Permalink
fix(search): useDeferredValue to lag behind on search
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoSerranoP committed Dec 17, 2024
1 parent f28079b commit 7d5670e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -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 });

Expand All @@ -34,7 +35,7 @@ export const Projects = ({ pollId = "" }: IProjectsProps): JSX.Element => {

const projects = useSearchProjects({
pollId,
search: searchTerm,
search: deferredSearchTerm,
registryAddress: round?.registryAddress ?? zeroAddress,
});

Expand Down

0 comments on commit 7d5670e

Please sign in to comment.