Skip to content
This repository has been archived by the owner on Mar 29, 2021. It is now read-only.

Commit

Permalink
fix: refresh reference list issue
Browse files Browse the repository at this point in the history
This fixes an issue caused by the `pruneOrphanedCitations` method
in the `store.ts` not being able to handle cases where there are
more than 1 orphaned citation in the document at a time.

Closes #303
  • Loading branch information
dsifford committed Aug 23, 2017
1 parent d42f1a4 commit f166efb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/js/reference-list/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ class CitationStore {
*/
@action
pruneOrphanedCitations(citationIds: string[]): void {
if (this.byIndex.length === citationIds.length) return;
const index = this.byIndex.findIndex(a => !citationIds.includes(a.citationID!));
this.byIndex.replace([...this.byIndex.slice(0, index), ...this.byIndex.slice(index + 1)]);
this.byIndex.replace(
this.byIndex.filter(citation => citationIds.includes(citation.citationID!)),
);
}

/**
Expand Down

0 comments on commit f166efb

Please sign in to comment.