This repository has no description
0

Configure Feed

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

semble / src / webapp / features / feeds / lib / queries / useGlobalFeed.tsx
677 B 27 lines
1import { useSuspenseInfiniteQuery } from '@tanstack/react-query'; 2import { getGlobalFeed } from '../dal'; 3import { feedKeys } from '../feedKeys'; 4 5interface Props { 6 limit?: number; 7} 8 9export default function useGlobalFeed(props?: Props) { 10 const limit = props?.limit ?? 15; 11 12 const query = useSuspenseInfiniteQuery({ 13 queryKey: feedKeys.infinite(), 14 initialPageParam: 1, 15 queryFn: ({ pageParam = 1 }) => { 16 return getGlobalFeed({ limit, page: pageParam }); 17 }, 18 getNextPageParam: (lastPage) => { 19 if (lastPage.pagination.hasMore) { 20 return lastPage.pagination.currentPage + 1; 21 } 22 return undefined; 23 }, 24 }); 25 26 return query; 27}