agregado Scroll infinito para las encuestas

This commit is contained in:
2025-09-11 12:33:36 -04:00
parent 5ed7f20b24
commit 1ab03ea10b
12 changed files with 236 additions and 202 deletions

View File

@@ -17,7 +17,6 @@ export function useSafeInfiniteQuery<T, K = unknown>(
queryKey: [string, K?],
queryFn: ({ pageParam }: { pageParam: number }) => Promise<T>,
getNextPageParam: (lastPage: T, allPages: T[]) => number | undefined,
// options?: Omit<UseQueryOptions<T>, 'queryKey' | 'queryFn'>
) {
return useInfiniteQuery({
queryKey,
@@ -25,20 +24,4 @@ export function useSafeInfiniteQuery<T, K = unknown>(
getNextPageParam,
initialPageParam: 0,
})
}
// export function useAllProductInfiniteQuery(){
// return useInfiniteQuery({
// queryKey:['product'],
// queryFn: ({ pageParam = 0 }) => getAllProducts({ page: pageParam + 1, limit: 10 }),
// getNextPageParam: (lastPage, allPages) => {
// // Esta lógica determina el 'pageParam' para la siguiente página
// const nextPage = allPages.length;
// // Puedes añadir una condición para saber si hay más páginas
// if (lastPage.data.length < 10) return undefined;
// return nextPage;
// },
// initialPageParam: 0,
// })
// }
}