Skip to content

Commit a73351a

Browse files
authored
fix(overlay): take 1 on stable event (#3013)
1 parent d6374b1 commit a73351a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/framework/theme/components/cdk/overlay/dynamic/dynamic-overlay.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ describe('dynamic-overlay', () => {
332332
expect(instance.context).toBe(newContext);
333333
expect(instance.content).toBe(newContent);
334334
expect(renderContentSpy).toHaveBeenCalledTimes(3);
335-
expect(updatePositionSpy).toHaveBeenCalledTimes(4);
335+
expect(updatePositionSpy).toHaveBeenCalledTimes(3);
336336
});
337337

338338
it('should set component', () => {

src/framework/theme/components/cdk/overlay/dynamic/dynamic-overlay.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ComponentFactoryResolver, ComponentRef, Injectable, NgZone, Type } from '@angular/core';
2-
import { filter, takeUntil, distinctUntilChanged } from 'rxjs/operators';
2+
import { filter, takeUntil, distinctUntilChanged, take } from 'rxjs/operators';
33
import { Subject, BehaviorSubject, Observable, merge } from 'rxjs';
44

55
import { NbAdjustableConnectedPositionStrategy, NbPosition } from '../overlay-position';
@@ -234,7 +234,7 @@ export class NbDynamicOverlay {
234234
filter((destroyedOverlay: NbOverlayRef) => destroyedOverlay === overlay),
235235
);
236236

237-
this.zone.onStable.pipe(takeUntil(merge(this.destroy$, overlayDestroy$))).subscribe(() => this.updatePosition());
237+
this.zone.onStable.pipe(take(1), takeUntil(merge(this.destroy$, overlayDestroy$))).subscribe(() => this.updatePosition());
238238
}
239239

240240
protected updatePosition() {

0 commit comments

Comments
 (0)