Closed
Description
Version info
Angular:8
AngularFire:"5.2.1
I have main component that retrieve data from collection and i have sub component that retrieve different data from the same collection.
whats happened is that the sub-component snapshotChanges() trigger twice with the data it should retrieve and the data that retrieved by the parent component.
Parent component:
this.firestore.collection('galleries', ref => ref.where('user', '==', this.user.id)
.orderBy('date', 'desc'))
.snapshotChanges().pipe(
map(actions => actions.map(a => {
const data = a.payload.doc.data() as any;
data.id = a.payload.doc.id;
return data;
}))).subscribe((sessions) => {
console.log(sessions);
});
Child component:
this.firestore.collection('galleries', ref => ref.limit(6).orderBy('date', 'desc'))
.snapshotChanges().pipe(
map(actions => actions.map(a => {
const data = a.payload.doc.data() as any;
data.id = a.payload.doc.id;
return data;
}))).subscribe((sessions) => {console.log(sessions)})
in the child component i've limit the query to 6 document ' but it's subscription called twice, and displays both parent data child documents.
Any idea?
Metadata
Metadata
Assignees
Labels
No labels