Greetings everyone i am having trouble with the useInfiniteQuery function, the errors says No overload matches this call, please help me out

1 Like

i get rid of the whole error by adding a curly bracise after the arrow function of the queryFn but the i got a new error in the queryFn itselft please if you found any solutions tell me

Same problem in the same file and still have not found any solution. If you guys solve this issue then please tell me how do you resolve that?

i had the same issue, wouldnt build on vercel, turns out the parameter initialPageParam is a requirement for the function useInfiniteQuery

const useGames = (gameQuery: GameQuery) =>
  useInfiniteQuery<FetchResponse<Game>, Error>({
    queryKey: ["games", gameQuery],
    queryFn: ({ pageParam = 1 }) =>
        params: {
          genres: gameQuery.genreId,
          parent_platforms: gameQuery.platformId,
          ordering: gameQuery.sortOrder,
          search: gameQuery.searchText,
          page: pageParam,
    getNextPageParam: (lastPage, allPages) => {
      return ? allPages.length + 1 : undefined;
    initialPageParam: 1, //THIS LINE HERE!
    staleTime: 24 * 60 * 60 * 1000, //24h

set the parameter to 1 like above and poof all bugs gone