ambitiondev / cookiebot

Composable to use Cookiebot functionality in your Vue or Nuxt application,
https://vue-nuxt-cookiebot.netlify.app/
MIT License
5 stars 0 forks source link

Hydration error #21

Closed Aurion72 closed 27 minutes ago

Aurion72 commented 3 hours ago

Hello,

Im trying to use this package but i got an error :

image

I just installed the module and make a component :

<template>
  <div></div>
</template>

<script setup lang="ts">
  const { consentBanner } = useCookiebot({})
  consentBanner()
</script>

nuxt.config.ts

cookiebot: {
    autoConsentBanner: false,
    cookieBotId: process.env.COOKIEBOT_ID,
  },
bnachtweh commented 2 hours ago

Hi @Aurion72, thank you for your issue. Sadly I cannot reproduce your issue. Have you tried removing the module from Nuxt config to see if the problem persists? It seems like the mismatch is more on a templating level. The server renders an HTML comment regarding teleport, while the client renders an empty div?

If the problem only persists when the Cookiebot module is activated, can you please provide me with some more info, like:

Aurion72 commented 27 minutes ago

Thanks for your reply.

I've finally found the cause of the problem, it's nuxtUI's component which seems to conflict with your package or CookieBot itselft.

I couldn't say why, but I've wrapped in a and that seems to work.

https://github.com/nuxt/ui/blob/dev/src/runtime/components/overlays/Notifications.vue