TRPC not returning immediately on error
Simple:
Component:
ts
export function useSitemaps() {
const {
data: sitemapUrls,
isLoading: sitemapIsLoading,
isError: sitemapIsError,
error: sitemapError,
status: sitemapStatus,
} = trpc.sitemaps.getSitemap.useQuery(
{
url: sitemapUri,
}
);
return { sitemapUri, setSitemapUri, sitemapUrls, sitemapIsLoading, sitemapIsError, sitemapUrlForm, submitHandler, sitemapError, sitemapStatus, }; } ```
return { sitemapUri, setSitemapUri, sitemapUrls, sitemapIsLoading, sitemapIsError, sitemapUrlForm, submitHandler, sitemapError, sitemapStatus, }; } ```
3 Replies
after like the 4th console log, it shows the error ont he FE
i tried setting retry to false
if there's something wrong with they query then Tanstack Query Devtools should be able to help you. https://tanstack.com/query/v4/docs/framework/react/devtools
Devtools | TanStack Query React Docs
Wave your hands in the air and shout hooray because React Query comes with dedicated devtools! 🥳
When you begin your React Query journey, you'll want these devtools by your side. They help visualize all of the inner workings of React Query and will likely save you hours of debugging if you find yourself in a pinch!