79687396

Date: 2025-07-02 12:11:59
Score: 0.5
Natty:
Report link

While this type of errors can have multiple causes, in my specific case the error was caused by a race condition: parent component was listening to a BehaviorSubject in a service while a child component (in parent's <router-outlet>) was listening to routing events and subsequently updating the same BehaviorSubject.

So it was like

Parent Child Service
public mode: BehaviorSubject<T> = new BehaviorSubject(someVal);
Parent subscribes onInit this.mode.pipe(...).subscribe(); Child subscribes onInit this.route.params.pipe(tap(() => this.service.setMode(someVar)).subscribe() public setMode(var) {this.mode.next(var)} After which parent throws error
[fix] this.mode.pipe(observeOn(asyncScheduler),...).subscribe()

So observeOn(asyncScheduler) saved my day. Never heard of this pattern before, but it works just fine.

Reasons:
  • Blacklisted phrase (2): saved my day
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • High reputation (-1):
Posted by: pop