You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
📚 What are you trying to do? Please describe.
I'm trying to provide a value on the root Vue instance, and then inject this inside the various components / pages / layouts.
🔍 What have you tried?
I tried calling provide from setup() inside layouts/default.vueas was suggested in a couple of places, which kind of worked, but it doesn't look very clean to me (plus I'd need to have this code in every layout .... not very DRY)
I also encountered the suggestion of assigning a new setup function to app, but this seems like it would break as soon as another plugin also assigns its own setup function.
ℹ️ Additional context
Having some kind of onSetup hook available in plugins or global provide would solve this kind of issue, people using vue-apollo-composable would have a cleaner way of providing the apollo client.
I'm not sure how dependency injection interacts with SSR and if provide could be used independently on the server and client Vue instance.
The text was updated successfully, but these errors were encountered:
📚 What are you trying to do? Please describe.
I'm trying to
provide
a value on the root Vue instance, and theninject
this inside the various components / pages / layouts.🔍 What have you tried?
I tried calling
provide
fromsetup()
insidelayouts/default.vue
as was suggested in a couple of places, which kind of worked, but it doesn't look very clean to me (plus I'd need to have this code in every layout .... not very DRY)I also tried creating a Nuxt plugin, which seemed like the proper way to do this, but the global provide / inject method described in the proposed RFC isn't available.
I also encountered the suggestion of assigning a new
setup
function to app, but this seems like it would break as soon as another plugin also assigns its own setup function.ℹ️ Additional context
Having some kind of
onSetup
hook available in plugins or globalprovide
would solve this kind of issue, people usingvue-apollo-composable
would have a cleaner way of providing the apollo client.I'm not sure how dependency injection interacts with SSR and if
provide
could be used independently on the server and client Vue instance.The text was updated successfully, but these errors were encountered: