0

After upgrading to Angular15, we have a change in the behaviour of subscribing to events (redux) We are dispatching multiple events, one after the other within router.events.subscribe however, only last event arrives to the subscribe function


this.router.events.subscribe((val) => {
     this.ngRedux.dispatch({ type: 'typeX', payload: payloadX });
     this.ngRedux.dispatch({ type: 'typeY', payload: payloadY });// only this events arrive to subscribe 
function
//typeX and typeY events are defined in the same reducer
})

//subscribe function: (found in component constractor)
 this.MYEventsReducer$
            .pipe(takeUntil(this.ngUnsubscribe))
            .subscribe((data: any) => {
               // only typeY event arrives here
            });

Debugging the code we saw that both events arrived to the reducer, but only 1 arrived to the subscribe of the observable

M. Choen
  • 26
  • 3

0 Answers0