T
TanStack3y ago
molecular-blue

Prefetch Query error - Next.js

Hi everyone. I'm currently have this error when try prefetch a query on getServerSideProps. This is my code:
export const getServerSideProps: GetServerSideProps = async (ctx) => {
await queryClient.prefetchQuery({
queryKey: ["customers"],
queryFn: getCustomers,
});

return {
props: {
dehydratedState: dehydrate(queryClient),
}
}
}
export const getServerSideProps: GetServerSideProps = async (ctx) => {
await queryClient.prefetchQuery({
queryKey: ["customers"],
queryFn: getCustomers,
});

return {
props: {
dehydratedState: dehydrate(queryClient),
}
}
}
Anyone can help me?
No description
6 Replies
molecular-blue
molecular-blueOP3y ago
Anyone?
deep-jade
deep-jade3y ago
getCustomers returns something that isn't json serializable
molecular-blue
molecular-blueOP3y ago
I found the problem I'm returning the entire response but which data I need to return? Because in the moment the isSuccess on mutation it's returning false but it's true
molecular-blue
molecular-blueOP3y ago
this is my mutation
No description
molecular-blue
molecular-blueOP3y ago
No description
molecular-blue
molecular-blueOP3y ago
this is the method I'm calling to update the customer

Did you find this page helpful?