From 08b66503b54c2b269c54d62edeca506012276e79 Mon Sep 17 00:00:00 2001 From: Sam Willis Date: Wed, 16 Oct 2024 12:32:15 +0100 Subject: [PATCH] Debounce saerch --- demos/linearlite/src/components/TopFilter.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/demos/linearlite/src/components/TopFilter.tsx b/demos/linearlite/src/components/TopFilter.tsx index 0d9b0871..f181eb8a 100644 --- a/demos/linearlite/src/components/TopFilter.tsx +++ b/demos/linearlite/src/components/TopFilter.tsx @@ -7,6 +7,7 @@ import { MenuContext } from '../App' import FilterMenu from './contextmenu/FilterMenu' import { FilterState, useFilterState } from '../utils/filterState' import { PriorityDisplay, StatusDisplay } from '../types/types' +import debounce from 'lodash.debounce' interface Props { filteredIssuesCount: number @@ -34,12 +35,12 @@ export default function ({ `SELECT COUNT(id) FROM issue WHERE deleted = false` )?.rows[0].count - const handleSearchInner = (query: string) => { + const handleSearchInner = debounce((query: string) => { setFilterState({ ...filterState, query: query, }) - } + }, 300) const handleSearch = (query: string) => { setSearchQuery(query)