diff --git a/src/framework/theme/components/cdk/overlay/overlay-trigger.ts b/src/framework/theme/components/cdk/overlay/overlay-trigger.ts index 27450030f7..4dac80b9fa 100644 --- a/src/framework/theme/components/cdk/overlay/overlay-trigger.ts +++ b/src/framework/theme/components/cdk/overlay/overlay-trigger.ts @@ -102,14 +102,13 @@ export class NbHoverTriggerStrategy extends NbTriggerStrategyBase { show$: Observable = observableFromEvent(this.host, 'mouseenter') .pipe( filter(() => !this.container()), + // this `delay & takeUntil & repeat` operators combination is a synonym for `conditional debounce` + // meaning that if one event occurs in some time after the initial one we won't react to it delay(100), + // tslint:disable-next-line:rxjs-no-unsafe-takeuntil + takeUntil(observableFromEvent(this.host, 'mouseleave')), repeat(), - takeUntil( - observableMerge( - observableFromEvent(this.host, 'mouseleave'), - this.destroyed$, - ), - ), + takeUntil(this.destroyed$), ); hide$: Observable = observableFromEvent(this.host, 'mouseleave') @@ -133,16 +132,13 @@ export class NbHoverTriggerStrategy extends NbTriggerStrategyBase { export class NbHintTriggerStrategy extends NbTriggerStrategyBase { show$: Observable = observableFromEvent(this.host, 'mouseenter') .pipe( - delay(100), // this `delay & takeUntil & repeat` operators combination is a synonym for `conditional debounce` // meaning that if one event occurs in some time after the initial one we won't react to it + delay(100), + // tslint:disable-next-line:rxjs-no-unsafe-takeuntil + takeUntil(observableFromEvent(this.host, 'mouseleave')), repeat(), - takeUntil( - observableMerge( - observableFromEvent(this.host, 'mouseleave'), - this.destroyed$, - ), - ), + takeUntil(this.destroyed$), ); hide$: Observable = observableFromEvent(this.host, 'mouseleave')