Skip to content

Commit

Permalink
Merge pull request #1186 from thunderstore-io/08-28-add_minimum_refre…
Browse files Browse the repository at this point in the history
…sh_time_for_search_inputs

Add minimum refresh time for search inputs
  • Loading branch information
Oksamies authored Aug 28, 2024
2 parents c40f40c + c8125e1 commit 8da5874
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ export function PackageSearch(props: Props) {
.filter((c) => c.selection === "exclude")
.map((c) => c.id);

const [debouncedSearchValue] = useDebounce(searchValue, 300);
const [debouncedSearchValue] = useDebounce(searchValue, 300, {
maxWait: 300,
});

const deferredCreatedAfter = useDeferredValue(createdAfter);
const deferredCreatedBefore = useDeferredValue(createdBefore);
Expand Down
4 changes: 3 additions & 1 deletion apps/cyberstorm-remix/app/communities/communities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ export default function CommunitiesPage() {
const [searchValue, setSearchValue] = useState(
searchParams.getAll("search").join(" ")
);
const [debouncedSearchValue] = useDebounce(searchValue, 300);
const [debouncedSearchValue] = useDebounce(searchValue, 300, {
maxWait: 300,
});

useEffect(() => {
if (debouncedSearchValue === "") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ function ValidationElement(props: {
message: string;
}>({ status: "waiting", message: "Waiting for input" });

const [valArgs] = useDebounce({ ...validator.args }, 300);
const [valArgs] = useDebounce({ ...validator.args }, 300, {
maxWait: 300,
});

const getValidation = () => usePromise(validator.validationFunc, [valArgs]);

Expand Down

0 comments on commit 8da5874

Please sign in to comment.