Hybrid rendering on Vercel and dynamic cart data from cookie

I'm trying to configure hybrid rendering on Vercel for a headless Shopify e-commerce site and I'm having trouble getting the cart item count to display correctly on pre-rendered pages. The cart data comes from a composable that executes const cart = useState('cart', () => cartCookie.value || cartDefault). I tried wrapping the cart icon component inside <ClientOnly> but the cart item count is always stale when the cache is hit. Is the only / best solution to initialize the cart state inside onMounted or am I missing something obvious ?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server