vue-disqus icon indicating copy to clipboard operation
vue-disqus copied to clipboard

Doesn't work with Nuxt 3 SSR

Open mrleblanc101 opened this issue 2 years ago • 4 comments

Probably because you use window in script setup outside the onMounted hook. const currentRoute = ref(window.location.pathname)

Why not simply use const route = useRoute() and route.fullpath instead of referencing the window ?

mrleblanc101 avatar Jan 17 '23 05:01 mrleblanc101

I have the same issue with quasar.

neural-loop avatar Jun 28 '23 16:06 neural-loop

use <ClientOnly> seems to doing the work at the moment

strife-cloud avatar Jul 14 '23 12:07 strife-cloud

Just Wrap it like so: <client-only placeholder="Loading..."> <DisqusCount shortname='your_shortname_disqus' identifier="/blog/1" /> </client-only>

akereachu avatar Aug 27 '23 17:08 akereachu

@akereachu This works for the Disqus component, but with the DisqusCount it will complain about 'shortname' missing:

TypeError: Cannot read properties of undefined (reading 'shortname')

So it needs the shortname when the component loads

Edit:

Using the component like this:

<ClientOnly placeholder="loading...">
	<DisqusCount
		:shortname="name"
		:url="url"
		:identifier="id"
	></DisqusCount>
</ClientOnly>

Combined with just a local import

import { DisqusCount } from 'vue-disqus'

Using

  • Nuxt 3.7.4
  • Vue Disqus 5.1.0
  • Vue 3.3.4

fgd007 avatar Nov 16 '23 22:11 fgd007