Greetings! I am currently working with Angular and RxJS, and I'm trying to find a solution to wait for the store's data to be updated after an action is dispatched in order to perform some operations using that data. Below you can see a snippet of my relevant code in the component.ts
file:
ngOnInit() {
// Subscribe to the store and retrieve data from it
this.store.pipe(select(selectors.getDataSelector)).pipe(takeUntil(this.destroy$)).subscribe(x => {
this.data$ = x;
});
}
updateData() {
this.store.dispatch(new actions.getDataAction());
// This action triggers an HTTP request, stores the fetched data in the store which can be accessed via getDataSelector
// Now I need to implement a condition that checks if the store data has finished updating after the action, and then proceed to do something
if(/* Condition */) {
// Perform operations with this.data$
}
}