T
TanStack12mo ago
ratty-blush

useQuery doesn't reload data after reset from error boundary

I have an error boundary using the help of error.tsx in Next.js, and when my useQuery fails with an error, it falls back to this component. But when I hit reset, internally calling reset() on the error component, it goes back to the same page and shows the page I render when there's no data. My page has multiple tabs, and when this happens, even switching tabs shows no data in all of them even though I've passed tab in the queryKey. In one of the tabs I have a <select>, when I change the choice in that, it does reload; and once that gets data, I start getting data everywhere else too. What? why?
3 Replies
genetic-orange
genetic-orange12mo ago
TanStack | High Quality Open-Source Software for Web Developers
Headless, type-safe, powerful utilities for complex workflows like Data Management, Data Visualization, Charts, Tables, and UI Components.
From An unknown user
From An unknown user
ratty-blush
ratty-blushOP12mo ago
Not sure if I like sprinkling around these wrappers around my code :/ But I suppose it's a valid solution Getting this either way:
Error: Functions are not valid as a child of Client Components. This may happen if you return children instead of <children /> from render. Or maybe you meant to call this function rather than return it.
<... children={function children}>
^^^^^^^^^^^^^^^^^^^
Error: Functions are not valid as a child of Client Components. This may happen if you return children instead of <children /> from render. Or maybe you meant to call this function rather than return it.
<... children={function children}>
^^^^^^^^^^^^^^^^^^^
I copied the code in the link to a component which takes in a children prop Replacing <Page /> with {children}
ratty-blush
ratty-blushOP12mo ago
Nevermind, this issue was me being an idiot. I was returning an empty list irrespective of the tab, that's why
No description

Did you find this page helpful?