Skip to content

Commit 5ee108f

Browse files
authored
Merge pull request DSpace#5002 from pzlakowski/fix/eperson-create-form-hangs-app
fix: fixes eperson create submission would hang application
2 parents 2f94d77 + f2ded5c commit 5ee108f

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

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
@@ -165,7 +165,7 @@ describe('EPeopleRegistryComponent', () => {
165165
{ provide: AuthorizationDataService, useValue: authorizationService },
166166
{ provide: FormBuilderService, useValue: builderService },
167167
{ provide: Router, useValue: new RouterMock() },
168-
{ provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) },
168+
{ provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['setStaleByHrefSubstring']) },
169169
{ provide: PaginationService, useValue: paginationService },
170170
],
171171
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';
@@ -311,12 +309,12 @@ describe('EPersonDataService', () => {
311309
return of(`${restEndpointURL}/${linkPath}`);
312310
});
313311
});
314-
it('should remove the eperson hrefs in the request service', fakeAsync(() => {
315-
service.clearEPersonRequests();
316-
tick();
317-
318-
expect(requestService.removeByHrefSubstring).toHaveBeenCalledWith(epersonsEndpoint);
319-
}));
312+
it('should remove the eperson hrefs in the request service', (done) => {
313+
service.clearEPersonRequests().subscribe(() => {
314+
expect(requestService.setStaleByHrefSubstring).toHaveBeenCalledWith(epersonsEndpoint);
315+
done();
316+
});
317+
});
320318
});
321319

322320
describe('deleteEPerson', () => {

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 { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
@@ -277,10 +278,10 @@ export class EPersonDataService extends IdentifiableDataService<EPerson> impleme
277278
/**
278279
* Method that clears a cached EPerson request
279280
*/
280-
public clearEPersonRequests(): void {
281-
this.getBrowseEndpoint().pipe(take(1)).subscribe((link: string) => {
282-
this.requestService.removeByHrefSubstring(link);
283-
});
281+
public clearEPersonRequests(): Observable<string> {
282+
return this.getBrowseEndpoint().pipe(
283+
tap((href: string) => this.requestService.setStaleByHrefSubstring(href)),
284+
);
284285
}
285286

286287
/**

0 commit comments

Comments
 (0)