Skip to content

Commit 8b8086a

Browse files
PawelZlakowskigithub-actions[bot]
authored andcommitted
fix: fixes eperson create submission would hang application
(cherry picked from commit f0b1dcb)
1 parent 597f9d8 commit 8b8086a

3 files changed

Lines changed: 12 additions & 13 deletions

File tree

src/app/access-control/epeople-registry/epeople-registry.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ describe('EPeopleRegistryComponent', () => {
159159
{ provide: AuthorizationDataService, useValue: authorizationService },
160160
{ provide: FormBuilderService, useValue: builderService },
161161
{ provide: Router, useValue: new RouterMock() },
162-
{ provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) },
162+
{ provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['setStaleByHrefSubstring']) },
163163
{ provide: PaginationService, useValue: paginationService },
164164
],
165165
schemas: [NO_ERRORS_SCHEMA],

src/app/core/eperson/eperson-data.service.spec.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
22
import {
3-
fakeAsync,
43
TestBed,
5-
tick,
64
waitForAsync,
75
} from '@angular/core/testing';
86
import { Store } from '@ngrx/store';
@@ -319,12 +317,12 @@ describe('EPersonDataService', () => {
319317
return of(`${restEndpointURL}/${linkPath}`);
320318
});
321319
});
322-
it('should remove the eperson hrefs in the request service', fakeAsync(() => {
323-
service.clearEPersonRequests();
324-
tick();
325-
326-
expect(requestService.removeByHrefSubstring).toHaveBeenCalledWith(epersonsEndpoint);
327-
}));
320+
it('should remove the eperson hrefs in the request service', (done) => {
321+
service.clearEPersonRequests().subscribe(() => {
322+
expect(requestService.setStaleByHrefSubstring).toHaveBeenCalledWith(epersonsEndpoint);
323+
done();
324+
});
325+
});
328326
});
329327

330328
describe('getActiveEPerson', () => {

src/app/core/eperson/eperson-data.service.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
find,
1111
map,
1212
take,
13+
tap,
1314
} from 'rxjs/operators';
1415

1516
import { getEPersonEditRoute } from '../../access-control/access-control-routing-paths';
@@ -292,10 +293,10 @@ export class EPersonDataService extends IdentifiableDataService<EPerson> impleme
292293
/**
293294
* Method that clears a cached EPerson request
294295
*/
295-
public clearEPersonRequests(): void {
296-
this.getBrowseEndpoint().pipe(take(1)).subscribe((link: string) => {
297-
this.requestService.removeByHrefSubstring(link);
298-
});
296+
public clearEPersonRequests(): Observable<string> {
297+
return this.getBrowseEndpoint().pipe(
298+
tap((href: string) => this.requestService.setStaleByHrefSubstring(href)),
299+
);
299300
}
300301

301302
/**

0 commit comments

Comments
 (0)