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>) {
|
updateBundles(newBundlesPL: PaginatedList<Bundle>) {
|
||||||
const currentBundles = this.bundlesSubject.getValue();
|
const currentBundles = this.bundlesSubject.getValue();
|
||||||
const bundlesToAdd: Bundle[] = [];
|
|
||||||
|
|
||||||
// Only add bundles to the bundle subject if they are not present yet
|
// Only add bundles to the bundle subject if they are not present yet
|
||||||
newBundlesPL.page.forEach(newBundle => {
|
const bundlesToAdd = newBundlesPL.page
|
||||||
if (!currentBundles.some(currentBundle => currentBundle.id === newBundle.id)) {
|
.filter(bundleToAdd => !currentBundles.some(currentBundle => currentBundle.id === bundleToAdd.id));
|
||||||
bundlesToAdd.push(newBundle);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const updatedBundles = [...currentBundles, ...bundlesToAdd];
|
const updatedBundles = [...currentBundles, ...bundlesToAdd];
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user