rxjs linting (#671)

* rxjs linting

* fix lint error
This commit is contained in:
Denys Vuika
2018-09-29 08:34:16 +01:00
committed by GitHub
parent fe7fbcb004
commit 25e6f15ffc
6 changed files with 128 additions and 17 deletions

View File

@@ -49,7 +49,7 @@ import {
import { MinimalNodeEntity, QueryBody } from 'alfresco-js-api';
import { Subject } from 'rxjs';
import { MatListItem } from '@angular/material';
import { debounceTime, filter } from 'rxjs/operators';
import { debounceTime, filter, takeUntil } from 'rxjs/operators';
import {
EmptySearchResultComponent,
SearchComponent
@@ -84,6 +84,8 @@ import {
host: { class: 'adf-search-control' }
})
export class SearchInputControlComponent implements OnInit, OnDestroy {
onDestroy$: Subject<boolean> = new Subject<boolean>();
/** Toggles whether to use an expanding search control. If false
* then a regular input is used.
*/
@@ -156,7 +158,10 @@ export class SearchInputControlComponent implements OnInit, OnDestroy {
constructor(private thumbnailService: ThumbnailService) {
this.toggleSearch
.asObservable()
.pipe(debounceTime(this.toggleDebounceTime))
.pipe(
debounceTime(this.toggleDebounceTime),
takeUntil(this.onDestroy$)
)
.subscribe(() => {
if (this.expandable && !this.skipToggle) {
this.subscriptAnimationState =
@@ -194,15 +199,8 @@ export class SearchInputControlComponent implements OnInit, OnDestroy {
}
ngOnDestroy(): void {
if (this.focusSubject) {
this.focusSubject.unsubscribe();
this.focusSubject = null;
}
if (this.toggleSearch) {
this.toggleSearch.unsubscribe();
this.toggleSearch = null;
}
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
searchSubmit(event: any) {
@@ -299,7 +297,8 @@ export class SearchInputControlComponent implements OnInit, OnDestroy {
this.isSearchBarActive() &&
($event.type === 'blur' || $event.type === 'focusout')
);
})
}),
takeUntil(this.onDestroy$)
)
.subscribe(() => {
this.toggleSearchBar();

View File

@@ -62,9 +62,9 @@ export class SidenavComponent implements OnInit, OnDestroy {
this.store
.select(ruleContext)
.pipe(
takeUntil(this.onDestroy$),
map(rules => rules.repository),
distinctUntilChanged()
distinctUntilChanged(),
takeUntil(this.onDestroy$)
)
.subscribe(() => {
this.groups = this.extensions.getApplicationNavigation(

View File

@@ -25,7 +25,7 @@
import { Effect, Actions, ofType } from '@ngrx/effects';
import { Injectable } from '@angular/core';
import { map, take, switchMap } from 'rxjs/operators';
import { map, take, mergeMap } from 'rxjs/operators';
import {
DeleteLibraryAction,
DELETE_LIBRARY,
@@ -73,7 +73,7 @@ export class LibraryEffects {
@Effect()
createLibrary$ = this.actions$.pipe(
ofType<CreateLibraryAction>(CREATE_LIBRARY),
switchMap(() => this.content.createLibrary()),
mergeMap(() => this.content.createLibrary()),
map(node => new NavigateLibraryAction(node.entry.guid))
);