Open GJ-sanjay opened 4 months ago
yes , you have change the "isLoading" to "isPending"
it's property has been changed because of the new update.
should i replace isLoading with isPending everwhere? and also i tried replacing all and the home page had something bad happened
yes cause the appwrite is under maintenance. and where you get error of "isLoading" you can change that to "isPending"
Thanks king!
Hey me again ;( . I'm faced with another issue i cleared all the errors like you said and i implemented isPending as well in places i got error. Now i get error in queries.ts
do you have any idea how to fix this?
export const useGetPosts = () => {
return useInfiniteQuery({
queryKey: [QUERY_KEYS.GET_INFINITE_POSTS],
queryFn: getInfinitePosts,
getNextPageParam: (lastPage) => {
// If there's no data, there are no more pages.
if (lastPage && lastPage.documents.length === 0) {
return null;
}
// Use the $id of the last document as the cursor.
const lastId = lastPage?.documents[lastPage?.documents.length - 1].$id;
return lastId;
},
});
};
"getNextPageParam" in this Typescript is going to give you warning but we can ignore
hey @Viraj-Pr i got the same error like @GJ-sanjay so i did what this thread suggested now as of for getNextPageParam i am having this overload issue while deploying the project through vercel
No overload matches this call.
Overload 1 of 3, '(options: UndefinedInitialDataInfiniteOptions<DocumentList
can anyone help me out here
@Vidhanvyrs Hey, yes i have the solution for this error. // export const useGetPosts = () => { return useInfiniteQuery({ queryKey: [QUERY_KEYS.GET_INFINITE_POSTS], queryFn: getInfinitePosts as any, getNextPageParam: (lastPage: any) => { if (lastPage && lastPage.documents.length === 0) { return null; } const lastId = lastPage.documents[lastPage.documents.length - 1].$id; return lastId; }, initialPageParam: null, });
try this code and you all set .
its gonna show error of any but you can ignore and in the development this code is gonna support the infinite scrolling.
https://github.com/Viraj-Pr/Viraj/blob/main/src/lib/react-query/queriesAndMutations.ts
you can also check my repo.
thankyou so much 🤩 @Viraj-Pr this resolved my error however can you explain about this use of any and how it is resolving the error
@Vidhanvyrs the use of any : because we are using typescript, so typescript is always needs type to define variables( that's what is in nature of typescript ) and when we deploy our project using typescript without define type to variables it gots crash. and sometime we use complex api to pass the data and we can not define the type in that so we use "any" and typescript is gonna complain about that because "any" has no type to define thus typescript is going to ignore that complain and runs our code in production level.
Got it @Viraj-Pr 🙇
Everywhere isLoading property is used . I get this error and i have no idea how to tackle this. If i use chatgpt it completely alters my code. The error: Property 'isLoading' does not exist on type 'UseMutationResult<Session | undefined, Error, { email: string; password: string; }, unknown>'.ts(2339) This happens on Signinform, signupform, UpdatProfile, Postform Property 'isLoading' does not exist on type 'UseMutationResult<Session | undefined, Error, { email: string; password: string; }, unknown>'.ts(2339)