-
-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lazy-mode] this.$fireModule returns null IF this.$fire...Ready() is called in the same component #366
Comments
Hey @ismail-fathi Hard to debug without you sharing your code. Did you install Firebase? Could you share your package.json? |
Hey @lupas I have installed firebase and @nuxtjs/firebase
And that is my nuxtjs/firebase config '@nuxtjs/firebase',
{
config: {
apiKey: "XXXX",
authDomain: "XXXX",
databaseURL: "XXXX",
projectId: "XXXX",
storageBucket: "XXXX",
messagingSenderId: "XXXX",
appId: "XXXX",
measurementId: "XXXX"
},
lazy: true,
services: {
auth: true,
firestore: true,
functions: true,
storage: true
}, In my page I have a method where I want to use firestore but when I try to use submit() {
await this.$fire.firestoreReady()
console(this.$fireModule)
} I hope you now get a better understanding of what is wrong and thank you for your help! |
Like so: async submit() {
await this.$fire.firestoreReady()
console(this.$fireModule)
} |
my function is indeed async but still.. but still returns undefined |
Hmmmm, interesting. I just tested it and the same works for me perfectly: Did you add the module to modules resp. buildModules? modules: ['@nuxtjs/firebase'], |
yep it's in modules indeed shoud ['@nuxtjs/firebase'] be in buildModules? |
Can be in buildModules in this case, but this should not make a difference... Hm... you can log out |
My bad, I was already loading another Firebase service in a plugin ( @pimlie Any idea? |
Just upgraded and facing this issue. Should lazy just be disabled for now as a workaround? |
@lupas Sorry for late reply, injecting like this doesnt work reliably indeed. Sorry about that, we/Rafal found this out when I added lazy initialization for the nuxt sentry/module where I used the same injection scheme. For the sentry module we added this custom inject helper: https://github.com/nuxt-community/sentry-module/blob/master/lib/plugin.lazy.js#L186 which is called here: https://github.com/nuxt-community/sentry-module/blob/master/lib/plugin.lazy.js#L164. The problem is is that Nuxt uses a defineProperty to add the injection without a setter, so once you've injected something you cannot overwrite it anymore. See here for Nuxt's inject implementation: https://github.com/nuxt/nuxt.js/blob/dev/packages/vue-app/template/index.js#L181-L216 |
Apart from that issue, I also noticed that with |
Thanks @pimlie, will have a look at if we could solve this similarly in this module. @1hakr About I thought we documented this somewhere but it seems we missed it... thanks for the input! ToDo notes for myself or anyone who has time:
|
…re only called in V-components re #366
Hey @ismail-fathi & Co. Finally got to fixing this issue with the solution from @pimlie (which was plain simple) - so thanks you too, I appreciate it. Should now be working in v7.3.1 |
Hey! I'm facing the problem where I'm enabling lazy and I'm trying to
|
… in a plugin in lazy mode fixed forceInject failing when ...ready() is called in a plugin in lazy mode re #366
Thanks a lot @uppergoal , fixed that with v7.3.2 |
The problem is still happening for me with v7.3.2 (Since version v7.3.0). Version 7.2.3 worked fine so I'll downgrade to that version. |
Hmm... will have a look at it tomorrow, I'm quite sure I had it working with the fix. Same error message? |
Yeah sadly. I wish I could propose a fix to help you. In my plugin: **my nuxt.config: **
Version 7.2.3. is working perfectly fine. |
…ialize services in nuxt plugins re #366
@uppergoal |
Awesome! I just tested it and it works. Thanks @lupas for your work. Greatly appreciated. |
Version
@nuxtjs/firebase:
firebase:
nuxt:
Steps to reproduce
setup firebase as you normally do in nuxtjs
then call await this.$fire.firestoreReady()
then console.log(this.$fireModule)
What is actually happening?
the output is undifined
The text was updated successfully, but these errors were encountered: