Merge branch 'memory-leak-fixes_contribute-7.4' into memory-leak-fixes_contribute-7.6

This commit is contained in:
Alexandre Vryghem
2024-02-29 19:55:05 +01:00
3 changed files with 19 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
import { Component, EventEmitter, Input, OnInit, Output, ViewChild, ViewContainerRef } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output, ViewChild, ViewContainerRef, OnDestroy } from '@angular/core';
import { Bundle } from '../../../../core/shared/bundle.model';
import { Item } from '../../../../core/shared/item.model';
import { ResponsiveColumnSizes } from '../../../../shared/responsive-table-sizes/responsive-column-sizes';
@@ -16,7 +16,7 @@ import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
* Creates an embedded view of the contents. This is to ensure the table structure won't break.
* (which means it'll be added to the parents html without a wrapping ds-item-edit-bitstream-bundle element)
*/
export class ItemEditBitstreamBundleComponent implements OnInit {
export class ItemEditBitstreamBundleComponent implements OnInit, OnDestroy {
/**
* The view on the bundle information and bitstreams
@@ -67,4 +67,9 @@ export class ItemEditBitstreamBundleComponent implements OnInit {
this.viewContainerRef.createEmbeddedView(this.bundleView);
this.itemPageRoute = getItemPageRoute(this.item);
}
ngOnDestroy(): void {
this.viewContainerRef.clear();
}
}

View File

@@ -1,4 +1,4 @@
import { Component, OnInit, ViewChild, ViewContainerRef } from '@angular/core';
import { Component, OnInit, ViewChild, ViewContainerRef, OnDestroy } from '@angular/core';
@Component({
selector: 'ds-item-edit-bitstream-drag-handle',
@@ -10,7 +10,7 @@ import { Component, OnInit, ViewChild, ViewContainerRef } from '@angular/core';
* Creates an embedded view of the contents
* (which means it'll be added to the parents html without a wrapping ds-item-edit-bitstream-drag-handle element)
*/
export class ItemEditBitstreamDragHandleComponent implements OnInit {
export class ItemEditBitstreamDragHandleComponent implements OnInit, OnDestroy {
/**
* The view on the drag-handle
*/
@@ -23,4 +23,8 @@ export class ItemEditBitstreamDragHandleComponent implements OnInit {
this.viewContainerRef.createEmbeddedView(this.handleView);
}
ngOnDestroy(): void {
this.viewContainerRef.clear();
}
}

View File

@@ -1,4 +1,4 @@
import { Component, Input, OnChanges, OnInit, SimpleChanges, ViewChild, ViewContainerRef } from '@angular/core';
import { Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewChild, ViewContainerRef } from '@angular/core';
import { Bitstream } from '../../../../core/shared/bitstream.model';
import cloneDeep from 'lodash/cloneDeep';
import { ObjectUpdatesService } from '../../../../core/data/object-updates/object-updates.service';
@@ -21,7 +21,7 @@ import { getBitstreamDownloadRoute } from '../../../../app-routing-paths';
* Creates an embedded view of the contents
* (which means it'll be added to the parents html without a wrapping ds-item-edit-bitstream element)
*/
export class ItemEditBitstreamComponent implements OnChanges, OnInit {
export class ItemEditBitstreamComponent implements OnChanges, OnDestroy, OnInit {
/**
* The view on the bitstream
@@ -72,6 +72,10 @@ export class ItemEditBitstreamComponent implements OnChanges, OnInit {
this.viewContainerRef.createEmbeddedView(this.bitstreamView);
}
ngOnDestroy(): void {
this.viewContainerRef.clear();
}
/**
* Update the current bitstream and its format on changes
* @param changes