]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: ResourceGrid: correctly remove ResourceStore listener
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 20 May 2021 14:59:16 +0000 (16:59 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 20 May 2021 19:00:38 +0000 (21:00 +0200)
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@proxmox.com>
www/manager6/grid/ResourceGrid.js

index c6757e9b11361b007d5807594b2ea6eed6e23858..07048b885ba1a4f2b25c3cffc1a64308564eabf8 100644 (file)
@@ -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());
     },
 });