Skip to content

Commit

Permalink
Move instantiation of firestore to prevent race-problems.
Browse files Browse the repository at this point in the history
  • Loading branch information
Scarygami committed Oct 8, 2017
1 parent 2f5d602 commit 72a34a8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions firestore-element.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,11 @@
super();
this._firestoreProps = {};
this._firestoreListeners = {};
this.db = this.constructor.db || firebase.firestore();
}

connectedCallback() {
super.connectedCallback();
this.db = this.constructor.db || firebase.firestore();
const props = collect(this.constructor, 'properties');
for (let name in props) {
if (props[name].doc) {
Expand All @@ -143,7 +144,6 @@
this._firestoreBind('collection', props[name].collection, name, props[name].live, props[name].observes);
}
}
super.connectedCallback();
}

_firestoreBind(type, path, name, live = false, observes = []) {
Expand Down Expand Up @@ -205,7 +205,7 @@
delete this._firestoreListeners[name];
}
}
}
}
};
};
})(window);
</script>

0 comments on commit 72a34a8

Please sign in to comment.