error while using react-query prefetching and SSR in nextJs with Shadcn/ui
Hello, I'm creating a data-table component with shadcn/ui and I've noticed that when when I try to fetch the data and pass it to component It takes a little while to render, since the component takes a data prop of type <Stock[]>, but the data returned by the query adds an undefined type to it so I have to wait until Its successful then pass it to the component.
So I thought If of prefetching the query according to the docs to make it a little faster, but I get this error in the console and nothing changed pretty much.
Here is the code to the important files (since the post is too long I had to put in a file) and the error from the console:
the error:
5 Replies
ambitious-aquaOP•3y ago
Can someone answer me please 🥲
@TkDodo 🔮 sorry for mentioning but can you please take a look 🙏
generous-apricot•3y ago
Show your code in a structured way. This is hard to help
And if your code is too long to post, who would read it??
ambitious-aquaOP•3y ago
The code is not even long compared to some I've already seen in some other posts, it's cause im new to discord and I don't have nitro to write a long post, the code is just copy paste from the documentation just instead of the Posts component it has I've put mine.
flat-fuchsia•3y ago
this code transforms your Promise to a resolved promise of undefined:
it's in my FAQs:
https://tkdodo.eu/blog/react-query-fa-qs#logging
React Query FAQs
Answering the most frequently asked React Query questions
ambitious-aquaOP•3y ago
Thank you sir