Skip to content

Commit f9b58ec

Browse files
committed
130484: Filter new bundles
1 parent 41afcf9 commit f9b58ec

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,10 @@ export class ItemBitstreamsComponent extends AbstractItemUpdateComponent impleme
249249
*/
250250
updateBundles(newBundlesPL: PaginatedList<Bundle>) {
251251
const currentBundles = this.bundlesSubject.getValue();
252-
const bundlesToAdd: Bundle[] = [];
253252

254253
// Only add bundles to the bundle subject if they are not present yet
255-
newBundlesPL.page.forEach(newBundle => {
256-
if (!currentBundles.some(currentBundle => currentBundle.id === newBundle.id)) {
257-
bundlesToAdd.push(newBundle);
258-
}
259-
});
254+
const bundlesToAdd = newBundlesPL.page
255+
.filter(bundleToAdd => !currentBundles.some(currentBundle => currentBundle.id === bundleToAdd.id));
260256

261257
const updatedBundles = [...currentBundles, ...bundlesToAdd];
262258

0 commit comments

Comments
 (0)