From 55571853e2f67312260097c21b2a8abb14dd3e40 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Wed, 25 Mar 2020 11:43:32 -0400 Subject: [PATCH] provider record service: add currentProviderId This works around some race conditions fetching the current provider upon initialization; we should fix this so that current() can account for in-flight initialization or refreshes. Signed-off-by: Galen Charlton --- .../src/eg2/src/app/staff/acq/provider/provider-record.service.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/acq/provider/provider-record.service.ts b/Open-ILS/src/eg2/src/app/staff/acq/provider/provider-record.service.ts index 962a71b190..857891cd77 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/provider/provider-record.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/provider/provider-record.service.ts @@ -23,6 +23,7 @@ export class ProviderRecord { export class ProviderRecordService { private currentProvider: ProviderRecord; + private currentProviderId: number = null; constructor( private idl: IdlService, @@ -33,7 +34,8 @@ export class ProviderRecordService { } getProviderRecord(id: number): Observable { - console.debug('fetching provider'); + console.debug('fetching provider ' + id); + this.currentProviderId = id; return this.pcrud.search('acqpro', { id: id }, { flesh: 1, @@ -65,8 +67,8 @@ export class ProviderRecordService { } refreshCurrent(): Promise { - if (this.currentProvider) { - return this.fetch(this.currentProvider.id); + if (this.currentProviderId) { + return this.fetch(this.currentProviderId); } else { return Promise.reject(); } -- 2.11.0