adrianhajdin / social_media_app

Build a modern social app with a stunning UI with a native mobile feel, a special tech stack, an infinite scroll feature, and amazing performance using React JS, Appwrite, TypeScript, and more.
https://jsmastery.pro
1.07k stars 322 forks source link

"No overload matches this call" #8

Closed hmongdev closed 8 months ago

hmongdev commented 8 months ago

image

I'm running into a problem during deployment. I get this No overload matches this call error.

Found this.

It says I'm passing a parameter that doesn't match the specified overloads.

Thing is, my code is identical to the finished project.

fuzanu commented 8 months ago

it's because of tanstack query v5, use this code instead:

export const useGetPosts = () => { return useInfiniteQuery({ queryKey: [QUERY_KEYS.GET_INFINITE_POSTS], queryFn: getInfinitePosts as any, initialPageParam: 0, getNextPageParam: (lastPage: any) => { if (lastPage && lastPage.documents.length === 0) { return null; }

  const lastId = lastPage.documents[lastPage.documents.length - 1].$id;
  return lastId;
},

}); };

hmongdev commented 8 months ago

Thanks for the reply. I actually figured out it was due to initialPageParam: 0

I was able to get it working, thanks!

RandeepSingh72 commented 6 months ago

it's because of tanstack query v5, use this code instead:

export const useGetPosts = () => { return useInfiniteQuery({ queryKey: [QUERY_KEYS.GET_INFINITE_POSTS], queryFn: getInfinitePosts as any, initialPageParam: 0, getNextPageParam: (lastPage: any) => { if (lastPage && lastPage.documents.length === 0) { return null; }

  const lastId = lastPage.documents[lastPage.documents.length - 1].$id;
  return lastId;
},

}); };

thanks bro

iMo7y commented 5 months ago

Your a legend fuzanu had the same issue