Public and private scoped data on the same route endpoint
Unanswered
Siamese posted this in #help-forum
SiameseOP
I'm trying to make an endpoint for the client like /user/[username] where user profile information is fetched, but server caching is disabled against private information
Essentially I want thinks like the name and profile picture, and public items to fetch and cache naturally with nextjs, but I also want it to fetch private things like privately flagged items with no-cache (and possibly client-based cache) to avoid cross pollination and keep the application smooth
The easiest answer seemed to be to create an endpoint that differentiates the current user session, like /user/me, but that creates issues with a user copying the link to share with someone else
The slightly better answer I could come up with is to immediately fetch public-facing items, and then have private items streaming in with a suspense, but that seems like it's very awkward and will just cause data to load in strange orders. I'd rather keep it as one fetch from the back end.
Are there any easy solutions to this I might be missing? Thanks for taking time to read
Essentially I want thinks like the name and profile picture, and public items to fetch and cache naturally with nextjs, but I also want it to fetch private things like privately flagged items with no-cache (and possibly client-based cache) to avoid cross pollination and keep the application smooth
The easiest answer seemed to be to create an endpoint that differentiates the current user session, like /user/me, but that creates issues with a user copying the link to share with someone else
The slightly better answer I could come up with is to immediately fetch public-facing items, and then have private items streaming in with a suspense, but that seems like it's very awkward and will just cause data to load in strange orders. I'd rather keep it as one fetch from the back end.
Are there any easy solutions to this I might be missing? Thanks for taking time to read