Reputation: 22966
I'd like to do a server side data query but only one time when a person logs into a website. The data will be passed down to the frontend and stored in a context so further navigations via next/link will preserve this existing data.
The basic premise is I have a user with account details (username, display photo, etc) - I want to query all this data once via the server and store that data in the browser (using react contexts) to avoid having to refetch the data between page navigations.
I looked into getStaticProps but that won't do it for me as the data is very dynamic and user specific, the other idea I had was for the application to be aware it has the data and include a query param like "dontFetchData=true" so taht subsequent navigations don't unecessarily refetch data the client already has.
Is that a reasonable solution or am I barking up the wrong tree here?
Upvotes: 2
Views: 1360
Reputation: 678
Short answer: there is no possibility to do this. https://github.com/vercel/next.js/discussions/18210
Upvotes: 1