Skip to content

Commit f475a4f

Browse files
[CST-5249] fix deletion propagation
1 parent 5d85e51 commit f475a4f

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/app/suggestions-page/suggestions-page.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ describe('SuggestionPageComponent', () => {
135135
scheduler.schedule(() => fixture.detectChanges());
136136
scheduler.flush();
137137
component.ignoreSuggestion('1');
138-
tick(101);
139138
expect(mockSuggestionsService.ignoreSuggestion).toHaveBeenCalledWith('1');
140139
expect(mockSuggestionsTargetStateService.dispatchRefreshUserSuggestionsAction).toHaveBeenCalled();
140+
tick(201);
141141
expect(component.updatePage).toHaveBeenCalled();
142142
}));
143143

src/app/suggestions-page/suggestions-page.component.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
22
import { ActivatedRoute, Data, Router } from '@angular/router';
33

44
import { BehaviorSubject, combineLatest, Observable } from 'rxjs';
5-
import { delay, distinctUntilChanged, map, switchMap, take } from 'rxjs/operators';
5+
import { distinctUntilChanged, map, switchMap, take } from 'rxjs/operators';
66
import { TranslateService } from '@ngx-translate/core';
77

88
import { SortDirection, SortOptions, } from '../core/cache/models/sort-options.model';
@@ -155,11 +155,10 @@ export class SuggestionsPageComponent implements OnInit {
155155
* @suggestionId
156156
*/
157157
ignoreSuggestion(suggestionId) {
158-
this.suggestionService.ignoreSuggestion(suggestionId).pipe(
159-
delay(100)
160-
).subscribe(() => {
158+
this.suggestionService.ignoreSuggestion(suggestionId).subscribe(() => {
161159
this.suggestionTargetsStateService.dispatchRefreshUserSuggestionsAction();
162-
this.updatePage();
160+
//We add a little delay in the page refresh so that we ensure the deletion has been propagated
161+
setTimeout(() => this.updatePage(), 200);
163162
});
164163
}
165164

0 commit comments

Comments
 (0)