Share Replay

Observable A is combineLatest([B,C]).

Subscribing to it later doesn’t work, as no more events would be raised (combineLatest would wait for B and C to emit).

Use takeUntil(this.done$), shareReplay(1) for A as the last step in the pipe.

this.done$ should be a Subject with ngOnDestroy as the trigger:

  ngOnDestroy(): void {
    this.done$.next(true);
    this.done$.complete();
  }

shareReplay(1) completes only when all sources complete, so you’ll have a memory leak (thanks ngrx).