nuxt-community / google-optimize-module

SSR friendly Google Optimize module for Nuxt.js
MIT License
215 stars 32 forks source link

Hydration error while using v-if #45

Open eljass opened 3 years ago

eljass commented 3 years ago

We got a hydration error when showing other variants than the first one on the first visit on site. This is due to that the server-side code that contains active variation to be the first index and then immediately after the variant changes.

I used v-if to conditionally render the visible component. Using v-show fixes this error but then the first variant will flash at the first load. Is it possible to trigger variant selection before Nuxt creates HTML code in the server? Right now we have fixed this by wrapping these components inside <client-only> tags, but this shows a blank area (or placeholder) for the area where the component should appear.