Skip to content

Commit

Permalink
Update firestore.service.ts
Browse files Browse the repository at this point in the history
keep tracking of changes using snapshotChanges(), 'cause get() doesn't seems to get live changes
  • Loading branch information
AXeL-dev committed Aug 13, 2020
1 parent b7c2246 commit 5aee207
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app/services/firestore.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ export class FirestoreService {
// console.log(name + ' found in cache');
resolve(this.cache[name]);
} else if (! this.subscriptions[name]) {
this.subscriptions[name] = this.db.collection(name).get().subscribe((snapshot) => {
this.subscriptions[name] = this.db.collection(name).snapshotChanges().subscribe((snapshot) => {
// console.log(snapshot);
let docs = {};
snapshot.forEach(doc => {
snapshot.forEach(({ payload: { doc } }) => {
// console.log(doc);
docs[doc.id] = this.convertDataForDisplay(doc.data());
});
Expand Down

0 comments on commit 5aee207

Please sign in to comment.