From f8487c211fc21653be70109e9e711ee89b6d2450 Mon Sep 17 00:00:00 2001 From: Douglas Fabris Date: Mon, 25 Nov 2024 14:51:32 -0300 Subject: [PATCH] regression: `AppsFilters` text search freezing when typing (#34051) --- .../client/views/marketplace/AppsPage/AppsFilters.tsx | 5 +---- .../client/views/marketplace/AppsPage/AppsPageContent.tsx | 7 ++++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/apps/meteor/client/views/marketplace/AppsPage/AppsFilters.tsx b/apps/meteor/client/views/marketplace/AppsPage/AppsFilters.tsx index 31648a70c7da..fb7c37d98e17 100644 --- a/apps/meteor/client/views/marketplace/AppsPage/AppsFilters.tsx +++ b/apps/meteor/client/views/marketplace/AppsPage/AppsFilters.tsx @@ -13,10 +13,7 @@ import type { RadioDropDownGroup, RadioDropDownOnSelected } from '../definitions type AppsFiltersProps = { text: string; - setText: React.Dispatch> & { - flush: () => void; - cancel: () => void; - }; + setText: (text: string) => void; freePaidFilterStructure: RadioDropDownGroup; freePaidFilterOnSelected: RadioDropDownOnSelected; categories: CategoryDropDownListProps['categories']; diff --git a/apps/meteor/client/views/marketplace/AppsPage/AppsPageContent.tsx b/apps/meteor/client/views/marketplace/AppsPage/AppsPageContent.tsx index 699257c7f357..be647eecc7ac 100644 --- a/apps/meteor/client/views/marketplace/AppsPage/AppsPageContent.tsx +++ b/apps/meteor/client/views/marketplace/AppsPage/AppsPageContent.tsx @@ -1,4 +1,4 @@ -import { useDebouncedState } from '@rocket.chat/fuselage-hooks'; +import { useDebouncedValue } from '@rocket.chat/fuselage-hooks'; import { useRouteParameter, useRouter } from '@rocket.chat/ui-contexts'; import type { ReactElement } from 'react'; import React, { useEffect, useMemo, useState, useCallback } from 'react'; @@ -29,7 +29,8 @@ type AppsContext = 'explore' | 'installed' | 'premium' | 'private' | 'requested' const AppsPageContent = (): ReactElement => { const { t } = useTranslation(); const { marketplaceApps, installedApps, privateApps, reload } = useAppsResult(); - const [text, setText] = useDebouncedState('', 500); + const [text, setText] = useState(''); + const debouncedText = useDebouncedValue(text, 500); const { current, itemsPerPage, setItemsPerPage: onSetItemsPerPage, setCurrent: onSetCurrent, ...paginationProps } = usePagination(); const router = useRouter(); @@ -127,7 +128,7 @@ const AppsPageContent = (): ReactElement => { const [categories, selectedCategories, categoryTagList, onSelected] = useCategories(); const appsResult = useFilteredApps({ appsData: getAppsData(), - text, + text: debouncedText, current, itemsPerPage, categories: useMemo(() => selectedCategories.map(({ label }) => label), [selectedCategories]),