polymerfire
polymerfire copied to clipboard
Move instantiation of firestore to prevent race-problems.
I've run into an issue when using FirestoreElement in the same element that has firebase-app.
Accessing firebase.firestore() in the constructor happened before firebase-app had a chance to initialize the app, resulting in an error.
A workaround would have been to create a separate element with the FirestoreElement mixin to load the data and retrieve the data from there instead of using a Firestore property directly, but the error was easy enough to fix this way.
Could this issue maybe get fixed? I recently ran into the same error @Scarygami described and the fix seems to be working.
I've rebased this PR against the current firestore branch. This is the version I'm currently using without problems.
(Also gets rids of the "The behavior for Date objects stored in Firestore is going to change AND YOUR APP MAY BREAK." warning)
Also moved the super.connectedCallback back to the end. This move only solved issues in the original version of this mixin, which has significantly changed since then.
I tried out your updated polymerfire firestore branch and for some reason I am still getting the no-app error, even though I have the firebase-app element imported and included in the element. Does maybe the PRPL pattern of the Polymer Starter Kit tamper with the firebase-app initialization?