Currently working on setting this up on our NextJs...
# ask-questions
m
Currently working on setting this up on our NextJs/React site. I’ve read about the hybrid SSR support (https://docs.growthbook.io/lib/react#hybrid-ssr--client-side). We want to use this to prevent flickering. In
getServerSideGrowthBookContext
(as per the example on the same page) we set some polyfills and also set the id attribute. This attribute is read from cookies. This is a problem for us since we are using Cloudflare to cache our pages. Cookies are cached as well. So we can’t use any unique id here. So, the userId that we are commonly using on our site can’t be read on the server since it’s cached - it’s only safe for us to read it on the browser. But that means we’ll have flickering, since we won’t be able to set the id until we’re in browser land (the id is hashed to determine variant AFAIK, so GB won’t know about the correct variant until some delay, right?). How is this usually solved? Is our setup non-standard, or does this SSR approach only work for pages that aren’t cached? Any input is appreciated!
Bumping this 🙂 We’ve decided to only run things client-side for the time being - but would be happy to hear if there’s anything we’re missing and if it’s possible to make this work with SSR + Cloudflare cache. Let me know if there’s anything I can clarify.