I have a stream daysFromApi$
with data (days with meals) from API. When a 'delete' button is clicked, I push mealId to this.deleteBus$. I want to have a new value in the stream: daysAfterDelete$
. My problem is that 'first' event is always triggered, but 'done' never triggers, flatMapLatest
does not work, map
neither.
const daysAfterDelete$ = this.deleteBus$
.log('first') // triggers when new mealId is pushed to deleteBus(a button is clicked)
.flatMapLatest(mealId => Bacon.combineAsArray(daysFromApi$, mealId))
.log('done'); // never triggers
I want to get following flow:
daysFromApi$ : A B C
deleteBus$ : 1 2 3
daysAfterDelete$: (1,A) (2,B) (3,B)
Not quite sure what you want to achieve, but if you want to get the latest value of "days" when the delete is clicked, you can use sampledBy
. https://www.webpackbin.com/bins/-Ki3lTzM8PM4zeJKK9C0