From 9b2f2836ab82476ee227eef78d2c10e3a9ce2644 Mon Sep 17 00:00:00 2001 From: Olaf Sulich Date: Tue, 14 Jan 2025 11:17:31 +0100 Subject: [PATCH] refactor(FullSearch): replace useDebounce with useDebouncedCallback for improved performance --- src/script/page/MainContent/panels/Collection/FullSearch.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/script/page/MainContent/panels/Collection/FullSearch.tsx b/src/script/page/MainContent/panels/Collection/FullSearch.tsx index b42bc662239..ea1002b3710 100644 --- a/src/script/page/MainContent/panels/Collection/FullSearch.tsx +++ b/src/script/page/MainContent/panels/Collection/FullSearch.tsx @@ -19,7 +19,7 @@ import React, {useEffect, useMemo, useRef, useState} from 'react'; -import {useDebounce} from 'use-debounce'; +import {useDebouncedCallback} from 'use-debounce'; import {CloseIcon, Input, InputSubmitCombo, SearchIcon} from '@wireapp/react-ui-kit'; @@ -54,7 +54,7 @@ const FullSearch: React.FC = ({searchProvider, click = noop, ch const [hasNoResults, setHasNoResults] = useState(false); const [element, setElement] = useEffectRef(); - const [debouncedSearch] = useDebounce(async () => { + const debouncedSearch = useDebouncedCallback(async () => { const trimmedInput = searchValue.trim(); change(trimmedInput); if (trimmedInput.length < 2) {