Skip to content
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

Open
wants to merge 102 commits into
base: next
Choose a base branch
from

Conversation

juliusmarminge
Copy link
Member

@juliusmarminge juliusmarminge commented Feb 6, 2024

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 promise

This 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 concerns

CleanShot.2024-03-07.at.23.03.56.mp4

Copy link

vercel bot commented Feb 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-prisma-starter ✅ Ready (Inspect) Visit Preview Jun 2, 2024 1:11pm
og-image ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 2, 2024 1:11pm
trpc-next-app-dir ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 2, 2024 1:11pm
www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 2, 2024 1:11pm

Copy link

github-actions bot commented Feb 6, 2024

Diagnostics Comparison

Numbers

Metric PR next
Files 798 799 (🔽🟢 -1)
Lines of Library 40,640 40,640 (➖ 0)
Lines of Definitions 120,661 120,867 (🔽🟢 -206)
Lines of TypeScript 4,967 4,967 (➖ 0)
Lines of JavaScript 0 0 (➖ 0)
Lines of JSON 0 0 (➖ 0)
Lines of Other 0 0 (➖ 0)
Identifiers 176,231 176,721 (🔽🟢 -490)
Symbols 109,589 109,932 (🔽🟢 -343)
Types 89 89 (➖ 0)
Instantiations 0 0 (➖ 0)
Memory used 173,752 171,277 (🔺 2,475)
Assignability cache size 0 0 (➖ 0)
Identity cache size 0 0 (➖ 0)
Subtype cache size 0 0 (➖ 0)
Strict subtype cache size 0 0 (➖ 0)

Timings and averages

Metric PR next
max (s) 4.31 4.354 (🔽🟢 -0.04)
min (s) 4.31 4.354 (🔽🟢 -0.04)
avg (s) 4.31 4.354 (🔽🟢 -0.04)
median (s) 4.31 4.354 (🔽🟢 -0.04)
length 1 1 (➖ 0)
unstable timings

Unstable

Timings are not reliable in here

Metric PR next
I/O Read time 0.04 0.04 (➖ 0)
Parse time 0.67 0.71 (🔽🟢 -0.04)
ResolveTypeReference time 0.03 0.03 (➖ 0)
ResolveModule time 0.1 0.12 (🔽🟢 -0.02)
ResolveLibrary time 0.02 0.03 (🔽🟢 -0.01)
Program time 0.99 1.04 (🔽🟢 -0.05)
Bind time 0.42 0.41 (🔺 0.01)
Total time 1.42 1.45 (🔽🟢 -0.03)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet