-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(react-query): next-app-router example with prefetch helpers #5451
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Diagnostics ComparisonNumbers
Timings and averages
unstable timingsUnstable
|
export const dynamic = 'force-dynamic'; | ||
|
||
export default function Home() { | ||
void trpc.getLatestPost.prefetch(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if a promise fails in a place like this?
is it safe / will node crash with "unhandled promise rejection"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void
will ignore errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then the query will be retried when it mounts on the client depending on your retry options
This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you. |
More integrated version of t3-oss/create-t3-turbo#877
adds a wrapped proxy around createCaller that puts the promise into a server-side QueryClient. devs can then choose to wrap some client component that needs some server prefetched data with the
<HydrateClient>
component. no network requests will be made from client components until the prefetched data goes stale:https://utfs.io/f/8278fdc7-572e-4b14-9f10-5f9fece747bb-yl67w4.15.58.mp4
you choose if you want to await the promise or not depending on if you also need to use the data in the RSC. if you void it, rendering wont be blocked until a
useSuspenseQuery
consumes the promiseThis gives the same behavior as the
ReactQueryStreamedProvider
, but you can do authed procedures since there's no fetching in client componetns, even on the server, so no need to hack the RSC headers into the CC which causes some weird security concernsCleanShot.2024-03-07.at.23.03.56.mp4