Skip to content

Commit

Permalink
fix(overlay): take 1 on stable event (#3013)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tibing committed Jan 31, 2022
1 parent d6374b1 commit a73351a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ describe('dynamic-overlay', () => {
expect(instance.context).toBe(newContext);
expect(instance.content).toBe(newContent);
expect(renderContentSpy).toHaveBeenCalledTimes(3);
expect(updatePositionSpy).toHaveBeenCalledTimes(4);
expect(updatePositionSpy).toHaveBeenCalledTimes(3);
});

it('should set component', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ComponentFactoryResolver, ComponentRef, Injectable, NgZone, Type } from '@angular/core';
import { filter, takeUntil, distinctUntilChanged } from 'rxjs/operators';
import { filter, takeUntil, distinctUntilChanged, take } from 'rxjs/operators';
import { Subject, BehaviorSubject, Observable, merge } from 'rxjs';

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

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

protected updatePosition() {
Expand Down

0 comments on commit a73351a

Please sign in to comment.