Skip to content

Commit fbf48c1

Browse files
committed
fix(lib): fix SingleAppBoundarySharingStrategy for late components
Use ReplaySubject with buffer set to Infinity for boundaries so they are stored and replayed for every new subscriber of component
1 parent c7b67b9 commit fbf48c1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

projects/ngx-element-boundary/src/lib/boundary-sharing-strategy/single-app-boundary-sharing-strategy.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Injectable } from '@angular/core';
2-
import { Observable, Subject } from 'rxjs';
2+
import { Observable, ReplaySubject } from 'rxjs';
33
import { scan, shareReplay } from 'rxjs/operators';
44

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

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

0 commit comments

Comments
 (0)