How to use with Nuxt Color module #762
-
Reproductionrepo: https://codesandbox.io/s/qpc7r?file=/pages/index.vue Expected behavioruse storeToRefs return store Actual behavioruse storeToRefs return undefined, but |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
Same issue here. It's worth noting that calling |
Beta Was this translation helpful? Give feedback.
-
I tried reproducing this at https://github.com/piniajs/example-nuxt-bridge with no success (your repro is too complex). One thing to note is that theme should probably be const theme = toRef(useNuxtApp().vue2App.$colorMode, 'preference') The use of reactive in your example is not correct and could be the reason it fails. If you can use my example to reproduce it, I can take a look but keep in mind you are using multiple other libraries. |
Beta Was this translation helpful? Give feedback.
-
I'll pop in a repro link as soon as I can |
Beta Was this translation helpful? Give feedback.
-
hi ,i test with
test flow:
|
Beta Was this translation helpful? Give feedback.
-
The problem seems to come from an incompatibility between Vue 3 and Note: Ideally nuxt color module should expose some |
Beta Was this translation helpful? Give feedback.
The problem seems to come from an incompatibility between Vue 3 and
@vue/composition-api
. I opened vuejs/composition-api#844. BasicallystoreToRefs()
doesn't work in Vue 2 yet.Note: Ideally nuxt color module should expose some
useColorPreference()
function to be used in the store or in any component because doinguseNuxtApp().vue2App.$colorMode
is hacky and will break when migrating to Vue 3 (this is unrelated to Pinia). I also saw they are working on a version compatible with Nuxt 3.