Skip to content

Commit

Permalink
fix(module:dropdown): should always debouce before subscribe visibleC…
Browse files Browse the repository at this point in the history
…hange$ (#237)

close #234
  • Loading branch information
Brooooooklyn authored and vthinkxie committed Sep 6, 2017
1 parent 6b69cf9 commit 0180e1c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/components/dropdown/nz-dropdown-button.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
EventEmitter,
AfterViewInit
} from '@angular/core';
import { debounceTime } from 'rxjs/operator/debounceTime';
import { DropDownAnimation } from '../core/animation/dropdown-animations';
import { NzDropDownDirective } from './nz-dropdown.directive';
import { NzDropDownComponent } from './nz-dropdown.component';
Expand Down
12 changes: 5 additions & 7 deletions src/components/dropdown/nz-dropdown.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export class NzDropDownComponent implements OnInit, OnDestroy, AfterViewInit {
}

_startSubscribe(observable$: Observable<boolean>) {
this._subscription = observable$
this._subscription = debounceTime.call(observable$, 300)
.subscribe(this._onVisibleChange)
}

Expand Down Expand Up @@ -182,12 +182,10 @@ export class NzDropDownComponent implements OnInit, OnDestroy, AfterViewInit {
return () => dispose();
});
}
const observable$ = debounceTime.call(
merge(
mouse$,
this.nzVisibleChange.asObservable()
)
, 300);
const observable$ = merge(
mouse$,
this.nzVisibleChange.asObservable()
);
this._startSubscribe(observable$);
}

Expand Down

0 comments on commit 0180e1c

Please sign in to comment.