polymerfire icon indicating copy to clipboard operation
polymerfire copied to clipboard

Unable to instanciate database

Open AnasSahel opened this issue 8 years ago • 4 comments

Hi all, In a situation where, imagine: App-shell: importsfirebase-app and firebase-auth. Based on the link, the App-Shell lazy loads a view, let's say view-a. view-a: has a firebase-document to load a user data.

Issue: user data never gets loaded because, when debugging the code, I found that the call to app.database() returns an undefined value.

Consequently, I must do an import of polymerfire.html to get over this issue.

AnasSahel avatar Dec 06 '16 14:12 AnasSahel

I need to document this better, but I was working on wrong assumptions myself. Firebase can be loaded modularly but not lazily. Once you initialize an app loading more modules will not add them to the existing app. You can still, though, do something like:

<link rel="import" href="bower_components/polymerfire/firebase-app.html">
<link rel="import" href="bower_components/polymerfire/firebase-auth.html">
<link rel="import" href="bower_components/polymerfire/firebase-database-script.html">

mbleigh avatar Dec 06 '16 18:12 mbleigh

This is one of those things that should be added to the docs for polymerfire with a big red notice box around it. I lost a few hours yesterday tracing this down. With all the emphasis on the PRPL pattern, this is something a lot of devs are going to stub their toes on.

jkhoffman avatar Feb 19 '17 23:02 jkhoffman

@mbleigh I can help with the documentation but would need guidance. Where do you want the documentation put? I can put it in the Readme if you want and ask a PR about it

tjmonsi avatar Feb 23 '17 15:02 tjmonsi

@mbleigh yay! Firebase updated with lazy load support!

https://firebase.google.com/support/release-notes/js#4.1.0

abdonrd avatar May 31 '17 17:05 abdonrd