Skip to content
Snippets Groups Projects
Commit 67e03025 authored by Mickael's avatar Mickael
Browse files

[US TRTL-268] fix switchmap without debounceTIme ?

parent c54e9d96
No related branches found
No related tags found
1 merge request!1Feature/design/1
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
*/ */
import { Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'; import { Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { merge, of, Subscription } from 'rxjs'; import { of, Subscription } from 'rxjs';
import { catchError, debounceTime, filter, map, switchMap } from 'rxjs/operators'; import { catchError, filter, map, switchMap } from 'rxjs/operators';
import { extend, isEmpty } from 'underscore'; import { extend, isEmpty } from 'underscore';
import { AuthService, buildValidators, diff, Profile, Role } from 'ui-frontend-common'; import { AuthService, buildValidators, diff, Profile, Role } from 'ui-frontend-common';
...@@ -45,8 +45,6 @@ import { AuthService, buildValidators, diff, Profile, Role } from 'ui-frontend-c ...@@ -45,8 +45,6 @@ import { AuthService, buildValidators, diff, Profile, Role } from 'ui-frontend-c
import { ProfileService } from '../../profile.service'; import { ProfileService } from '../../profile.service';
import { ProfileValidators } from '../../profile.validators'; import { ProfileValidators } from '../../profile.validators';
const DEBOUNCE_TIME = 400;
@Component({ @Component({
selector: 'app-information-tab', selector: 'app-information-tab',
templateUrl: './information-tab.component.html', templateUrl: './information-tab.component.html',
...@@ -91,9 +89,8 @@ export class InformationTabComponent implements OnDestroy, OnInit, OnChanges { ...@@ -91,9 +89,8 @@ export class InformationTabComponent implements OnDestroy, OnInit, OnChanges {
}); });
// TODO FIXME GET CUSTOMERID FROM PROFILE // TODO FIXME GET CUSTOMERID FROM PROFILE
this.updateFormSub = merge(this.form.valueChanges, this.form.statusChanges) this.updateFormSub = this.form.valueChanges
.pipe( .pipe(
debounceTime(DEBOUNCE_TIME),
map(() => diff(this.form.value, this.previousValue)), map(() => diff(this.form.value, this.previousValue)),
filter((formData) => !isEmpty(formData)), filter((formData) => !isEmpty(formData)),
map((formData) => this.completeRoles(formData)), map((formData) => this.completeRoles(formData)),
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment