How to combine client and server side data before page is rendered?
In a TanStack application, I have a SSR'd page where in the loader I'm gathering some records form a database (calling a server function, etc).
When this page is called, let's say, with a curl (or a browser without JS, or a web crawler, etc) that's all the information that I need for this page, so everything works great.
But when this page is first loaded in a web browser, I also need to load some data on the client (from a previously cached indexeddb database).
The issue, is that I need all of this data combined together before the page loads, so that I don't have to show any spinners, etc. Same thing when you navigate client side across pages. Each time you enter this page, both the loader plus the client-side data should be available for the page rendering before the route transition happens.
What's the recommended approach for doing this?
Thanks!
When this page is called, let's say, with a curl (or a browser without JS, or a web crawler, etc) that's all the information that I need for this page, so everything works great.
But when this page is first loaded in a web browser, I also need to load some data on the client (from a previously cached indexeddb database).
The issue, is that I need all of this data combined together before the page loads, so that I don't have to show any spinners, etc. Same thing when you navigate client side across pages. Each time you enter this page, both the loader plus the client-side data should be available for the page rendering before the route transition happens.
What's the recommended approach for doing this?
Thanks!