Client side data preparation #33680
Unanswered
alex-statsig
asked this question in
Help
Replies: 1 comment 3 replies
|
We are also dealing with this problem Still trying to find the correct place to call the loadQuery though just like you 😢 Code for reference |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
What's the best way to prime client-side data loading in nextjs? I'm pretty excited by React 18's concurrent rendering and suspense. A big part of this is data loading with suspense, and starting your data loading before rendering. For example, with relay calling loadQuery on transition to a page instead of during its first render, then using usePreloadedQuery in the render. However, I couldn't find a good place to call loadQuery with next.js. If there was a simple getClientsideProps called before page renders I could use that (or some kind of router hooks that could be integrated nicely with page metadata).
An ideal setup would be for the router to prioritize loading this data preparation function and call that right away, then worry about getting the components downloaded after.
Has anyone else found a solution to this? Is this something nextjs will address as Suspense / concurrent mode get more adopted?
All reactions