nuxt-modules / color-mode

Dark and Light mode with auto detection made easy with Nuxt 🌗
https://color-mode.nuxtjs.org
MIT License
1.12k stars 112 forks source link

Missing current instance. useRouter() must be called inside <script setup> or setup() #169

Closed Luferov closed 1 year ago

Luferov commented 2 years ago

Version

@nuxtjs/color-mode: 3.1.8 Nuxi 3.0.0-rc.11 Nuxt 2.16.0-27720022.54e852f with Nitro 0.5.4

What is Expected?

When using nuht/bridge with nuxt-rc.11, an error appears. image

image

P4sca1 commented 2 years ago

https://github.com/nuxt/bridge/issues/554

Luferov commented 2 years ago

nuxt/bridge#554

🤔

P4sca1 commented 2 years ago

Using useRouter() should work fine. This is an issue with Nuxt Bridge that got introduced in https://github.com/nuxt/bridge/pull/533 (see the issue I linked).

Luferov commented 2 years ago

Using useRouter() should work fine. This is an issue with Nuxt Bridge that got introduced in nuxt/bridge#533 (see the issue I linked).

Yep, but it doesn’t work. In nuxt/bridge#533 deleted useRoute, and this I added solution through nuxtApp.

P4sca1 commented 2 years ago

We should probably fix the upstream issue instead of adding a workaround in all modules where useRouter is used.

Luferov commented 2 years ago

I agree, however this fix allows the system to work now.

Luferov commented 2 years ago

@P4sca1 when this problem will resolve global, what do you thins about this?

P4sca1 commented 2 years ago

I don't know when the issue gets resolved. Maybe @danielroe can tell. But I think Nuxt 3 issues have priority before Nuxt Bridge issues at the moment.

danielroe commented 2 years ago

Yes, I think we should fix this in bridge.

Luferov commented 2 years ago

It would be great! ❤️

NtchPlayer commented 2 years ago

Hi ! Any news about this issue ? I see RC 12 of Nuxt 3 is now available, I don't know the delay between a new RC of Nuxt 3 and a new release of Nuxt Bridge 🤔

Luferov commented 2 years ago

@danielroe look like revert or no?

atinux commented 1 year ago

Can you confirm the bug is fixed with latest bridge?

Luferov commented 1 year ago

Can you confirm the bug is fixed with latest bridge?

Works good!