cachedComponents: true with redirect
Unanswered
Polar bear posted this in #help-forum
Polar bearOP
Hi! I am looking to enable cachedComponents: true in my app but I am having trouble figuring out the best way to keep my previous redirect patterns. My app has 20 pages~ and each page handles can redirect differently based on cookies + auth data from cookies so putting this in proxy will be tough. However, cachedComponents require me to wrap the redirect logic with Suspense due to cookies and I lose the "server" 307 redirect where the page must be streamed to the client first before the redirect happens now. I understand my ask is a deoptimization of what cachedComponents offer but the <Activity /> usage of cachedComponents is great for our app and I don't want to turn it off 🙁 Is there anyway to "bypass" or "opt out" of this behavior for a particular page? if not, how are people handling their existing server redirects?
2 Replies
Greek Shepherd
I was looking into this too but since you can use the use cache directive on any component, cant you just keep ur redirect login in the main page and move ur cacheable content to a subcomponent and use cache there?
Polar bearOP
do you have a code example of how that looks like?
let's also assume the entire page is dynamic where it will only render the main content after an API call. so it is basically wrapped with a suspense using a loading indicator. however, reading cookies is fast enough for our app so we don't mind the user waiting for the cookies logic for each dynamic page to resolve before rendering.
let's also assume the entire page is dynamic where it will only render the main content after an API call. so it is basically wrapped with a suspense using a loading indicator. however, reading cookies is fast enough for our app so we don't mind the user waiting for the cookies logic for each dynamic page to resolve before rendering.