An ATproto social media client -- with an independent Appview.
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

Throttle instead of debounce (#4456)

* throttle instead of debounce

* trailing: true

* Fix throttle call

---------

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>

authored by

Samuel Newman
Dan Abramov
and committed by
GitHub
fd03ea3f 1317d881

+6 -2
+6 -2
src/state/queries/messages/list-converations.tsx
··· 16 16 useInfiniteQuery, 17 17 useQueryClient, 18 18 } from '@tanstack/react-query' 19 - import debounce from 'lodash.debounce' 19 + import throttle from 'lodash.throttle' 20 20 21 21 import {useCurrentConvoId} from '#/state/messages/current-convo-id' 22 22 import {useMessagesEventBus} from '#/state/messages/events' ··· 91 91 const {currentAccount} = useSession() 92 92 93 93 const debouncedRefetch = useMemo( 94 - () => debounce(() => refetch, 500), 94 + () => 95 + throttle(refetch, 500, { 96 + leading: true, 97 + trailing: true, 98 + }), 95 99 [refetch], 96 100 ) 97 101