mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
130484: Filter new bundles
This commit is contained in:
@@ -198,14 +198,10 @@ export class ItemBitstreamsComponent extends AbstractItemUpdateComponent impleme
|
||||
*/
|
||||
updateBundles(newBundlesPL: PaginatedList<Bundle>) {
|
||||
const currentBundles = this.bundlesSubject.getValue();
|
||||
const bundlesToAdd: Bundle[] = [];
|
||||
|
||||
// Only add bundles to the bundle subject if they are not present yet
|
||||
newBundlesPL.page.forEach(newBundle => {
|
||||
if (!currentBundles.some(currentBundle => currentBundle.id === newBundle.id)) {
|
||||
bundlesToAdd.push(newBundle);
|
||||
}
|
||||
});
|
||||
const bundlesToAdd = newBundlesPL.page
|
||||
.filter(bundleToAdd => !currentBundles.some(currentBundle => currentBundle.id === bundleToAdd.id));
|
||||
|
||||
const updatedBundles = [...currentBundles, ...bundlesToAdd];
|
||||
|
||||
|
Reference in New Issue
Block a user