Skip to content
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

Move instantiation of firestore to prevent race-problems. #279

Open
wants to merge 2 commits into
base: firestore
Choose a base branch
from

Conversation

Scarygami
Copy link
Contributor

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.

@Westbrook Westbrook mentioned this pull request Feb 23, 2018
@stemuk
Copy link

stemuk commented May 28, 2018

Could this issue maybe get fixed? I recently ran into the same error @Scarygami described and the fix seems to be working.

@Scarygami
Copy link
Contributor Author

Scarygami commented May 28, 2018

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.

@stemuk
Copy link

stemuk commented May 29, 2018

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants