Skip to content

Commit

Permalink
regression: AppsFilters text search freezing when typing (#34051)
Browse files Browse the repository at this point in the history
  • Loading branch information
dougfabris authored and ggazzo committed Dec 5, 2024
1 parent d851181 commit f8487c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ import type { RadioDropDownGroup, RadioDropDownOnSelected } from '../definitions

type AppsFiltersProps = {
text: string;
setText: React.Dispatch<React.SetStateAction<string>> & {
flush: () => void;
cancel: () => void;
};
setText: (text: string) => void;
freePaidFilterStructure: RadioDropDownGroup;
freePaidFilterOnSelected: RadioDropDownOnSelected;
categories: CategoryDropDownListProps['categories'];
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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]),
Expand Down

0 comments on commit f8487c2

Please sign in to comment.