Cookies 🍪 in root layout and ISR
Answered
ludawkriss posted this in #help-forum
Hi. I know this isn't the first this is posted but i havn't found a correct answer to it.
Today we're consuming cookies in our root layout to be able to show personalized popup content on all pages across the app.
The app itself is a mix of content pages (articles etc.) and product listing pages. So i want to be able to build pages and serve other pages ad hoc from the server. Is this possible? I'm not seeing any cookies or headers in either SSG or ISR at them moment. Is this something being documented on how to or something PPR will fix?
Any solution proposal is VERY APPRECIATED. Take care, brush ya hair
Today we're consuming cookies in our root layout to be able to show personalized popup content on all pages across the app.
The app itself is a mix of content pages (articles etc.) and product listing pages. So i want to be able to build pages and serve other pages ad hoc from the server. Is this possible? I'm not seeing any cookies or headers in either SSG or ISR at them moment. Is this something being documented on how to or something PPR will fix?
Any solution proposal is VERY APPRECIATED. Take care, brush ya hair
Answered by James4u
yeah, so using PPR, you will show static shell at first and stream dynamic contents (in your case personalized popup content)
5 Replies
@ludawkriss So in both SSG and ISR, you pre-render your pages in build phase and you don't have access to cookie at that point, right?
If you want to show personalized popup content, you would need SSR or CSR instead
yeah, so using PPR, you will show static shell at first and stream dynamic contents (in your case personalized popup content)
Answer
Thank you! @James4u for clearing that out. 🙏
Mark solution to close the thread if you don't have any other questions