I am currently working on utilizing Ionic's loadingcontroller alongside a firestore query. From my understanding, this query returns an observable and also monitors changes in the query's value.
However, is there a way to determine within the function if the observable's value has changed? The issue I am facing is that the loader appears every time a click event occurs, even if there have been no changes. I would like the loader to only display if the result of the query has actually changed.
Here is my desired implementation:
category(category){
let loading = this.load.create({
content: 'Please wait...'
});
this.selected = category;
this.fsp.getCategory(category).subscribe(res => {
if(res has changed){
loading.present();
this.data = this.group.groupEvents(res);
loading.dismiss();
} else {
this.data = this.group.groupEvents(res);
}
});
}