Skip to content

Commit

Permalink
Fix #33
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Aug 21, 2021
1 parent e64b801 commit 5de0d97
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ class UnifiedCitationManager implements ICitationManager {
private styles: StylesManager;
private processors: WeakMap<DocumentWidget, Promise<CiteProc.IEngine>>;
private localeCache: Map<string, string>;
private updateInProgress = false;
protected defaultStyleID = 'apa.csl';
protected allReady: ICancellablePromise<any>;
protected formats: IAlternativeFormat<any>[];
Expand Down Expand Up @@ -537,13 +538,23 @@ class UnifiedCitationManager implements ICitationManager {
}

public async updateReferences() {
if (this.updateInProgress) {
return Promise.reject(
'Cancelling update - an update is already in progress'
);
}
this.updateInProgress = true;
return Promise.all(
[...this.providers.values()].map(provider =>
provider.updatePublications(true)
)
).then(() => {
this.updateReferenceBrowser();
});
)
.then(() => {
this.updateReferenceBrowser();
})
.finally(() => {
this.updateInProgress = false;
});
}

private collectOptions(
Expand Down

0 comments on commit 5de0d97

Please sign in to comment.