[pve-devel] [PATCH manager 7/7] ext6migrate: fix framework caching issue

Dominik Csapak d.csapak at proxmox.com
Fri Mar 11 15:57:34 CET 2016


in extjs 5/6 there is a caching issue, where they
save dom elements for reuse, but the garbage collector
can set them to null

when the framework now reuses the "cached" element it is null,
and any action on it produces an error, which breaks the site

for details see the forum link in the comment

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/Utils.js | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index d1c473c..457facc 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1,3 +1,36 @@
+// ExtJs 5-6 has an issue with caching
+// see https://www.sencha.com/forum/showthread.php?308989
+Ext.define('PVE.UnderlayPool', {
+    override: 'Ext.dom.UnderlayPool',
+
+    checkOut: function () {
+        var cache = this.cache,
+            len = cache.length,
+            el;
+
+        // do cleanup because some of the objects might have been destroyed
+	while (len--) {
+            if (cache[len].destroyed) {
+                cache.splice(len, 1);
+            }
+        }
+        // end do cleanup
+
+	el = cache.shift();
+
+        if (!el) {
+            el = Ext.Element.create(this.elementConfig);
+            el.setVisibilityMode(2);
+            //<debug>
+            // tell the spec runner to ignore this element when checking if the dom is clean
+	    el.dom.setAttribute('data-sticky', true);
+            //</debug>
+	}
+
+        return el;
+    }
+});
+
 Ext.ns('PVE');
 
 // avoid errors related to Accessible Rich Internet Applications
-- 
2.1.4





More information about the pve-devel mailing list