polymerfire
polymerfire copied to clipboard
Unable to instanciate database
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.
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">
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.
@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
@mbleigh yay! Firebase updated with lazy load support!
https://firebase.google.com/support/release-notes/js#4.1.0