[pve-devel] [PATCH manager 3/3] ui: ResourceGrid: correctly remove ResourceStore listener

Dominik Csapak d.csapak at proxmox.com
Thu May 20 16:59:16 CEST 2021


while the function in '.on' and '.un' are identical, they are not the
*same* function, thus the '.un' does not really remove the listener,
and we have leftover references to the grid which means it will never
really garbage-collected

instead, use '.mon' on the grid, which automatically cleans up the
listeners

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/grid/ResourceGrid.js | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/www/manager6/grid/ResourceGrid.js b/www/manager6/grid/ResourceGrid.js
index c6757e9b..07048b88 100644
--- a/www/manager6/grid/ResourceGrid.js
+++ b/www/manager6/grid/ResourceGrid.js
@@ -125,14 +125,11 @@ Ext.define('PVE.grid.ResourceGrid', {
 		    var ws = me.up('pveStdWorkspace');
 		    ws.selectById(record.data.id);
 		},
-		destroy: function() {
-		    rstore.un("load", () => updateGrid());
-		},
 	    },
             columns: rstore.defaultColumns(),
 	});
 	me.callParent();
 	updateGrid();
-	rstore.on("load", () => updateGrid());
+	me.mon(rstore, 'load', () => updateGrid());
     },
 });
-- 
2.20.1





More information about the pve-devel mailing list