Skip to content

Commit

Permalink
fix(lib): fix SingleAppBoundarySharingStrategy for late components
Browse files Browse the repository at this point in the history
Use ReplaySubject with buffer set to Infinity for boundaries so they are stored and replayed for
every new subscriber of component
  • Loading branch information
gund committed Jul 14, 2020
1 parent c7b67b9 commit fbf48c1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs';
import { Observable, ReplaySubject } from 'rxjs';
import { scan, shareReplay } from 'rxjs/operators';

import { ElementBoundary } from '../types';
Expand All @@ -11,7 +11,7 @@ import { BoundarySharingStrategy } from './boundary-sharing-strategy';
@Injectable({ providedIn: 'root' })
export class SingleAppBoundarySharingStrategy
implements BoundarySharingStrategy {
private readonly addBoundary$ = new Subject<ElementBoundary>();
private readonly addBoundary$ = new ReplaySubject<ElementBoundary>(Infinity);

private readonly boundaries$ = this.addBoundary$.pipe(
scan((acc, boundary) => [...acc, boundary], [] as ElementBoundary[]),
Expand Down

0 comments on commit fbf48c1

Please sign in to comment.