I have something like this currently
onValueChange() {
let someObj = //dynamically created
this.processUsers(someObj);
}
processUsers(someObj) {
from(Object.keys(someObj))
.pipe(
concatMap(key => this.getUsers(key)
)
.subscribe(res => ...)
}
onValueChange is a method called when something in a form changes and this triggers the method processUsers with an obj that was constructed when onValueChange is called.
processUsers then uses this obj to do some async tasks.
This works OK if there is a single trigger but if when processUsers is called consecutively with different objects, the async tasks gets messed up.
So, how can I use rxjs to complete processUsers to be done with the current obj before taking in the next? My first thought is to use an array that I would push someObj into and processUsers should subscribe to the array but I'm not sure how to approach this.