Skip to content

Commit c68426f

Browse files
committed
fix(service): improve performance of components initialization
By setting a debounce time (0s) on all boundaties stream
1 parent 5336adf commit c68426f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

projects/ngx-element-boundary/src/lib/element-boundary.service.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import { Injectable, Optional } from '@angular/core';
2-
import { Observable } from 'rxjs';
3-
import { filter, map, shareReplay } from 'rxjs/operators';
2+
import { Observable, of } from 'rxjs';
3+
import {
4+
debounceTime,
5+
filter,
6+
map,
7+
shareReplay,
8+
timeoutWith,
9+
} from 'rxjs/operators';
410

511
import { BoundarySharingStrategy } from './boundary-sharing-strategy/boundary-sharing-strategy';
612
import { ComponentSelectorStrategy } from './component-selector-strategy/component-selector-strategy';
@@ -14,6 +20,7 @@ import { isDefined } from './util';
1420
@Injectable({ providedIn: 'root' })
1521
export class ElementBoundaryService {
1622
private boundaries$ = this.boundarySharingStrategy.getBoundaries().pipe(
23+
debounceTime(0),
1724
map((boundaries) =>
1825
boundaries.sort((b1, b2) => this.sortBoundariesByDepth(b1, b2)),
1926
),

0 commit comments

Comments
 (0)