@@ -21,6 +21,8 @@ qx.Class.define("osparc.ui.table.cellrenderer.ImageButtonRenderer", {
2121 construct : function ( clickAction , iconPath ) {
2222 this . base ( arguments , clickAction ) ;
2323
24+ this . __imageCache = { } ;
25+
2426 this . setIconPath ( iconPath ) ;
2527 } ,
2628
@@ -34,6 +36,8 @@ qx.Class.define("osparc.ui.table.cellrenderer.ImageButtonRenderer", {
3436 } ,
3537
3638 members : {
39+ __imageCache : null ,
40+
3741 __applyIconPath : function ( iconPath ) {
3842 const resMgr = qx . util . ResourceManager . getInstance ( ) ;
3943 const iconUrl = resMgr . toUri ( iconPath ) ;
@@ -44,17 +48,11 @@ qx.Class.define("osparc.ui.table.cellrenderer.ImageButtonRenderer", {
4448 } ,
4549
4650 __loadImageAsDataUri : function ( iconUrl , iconPath ) {
47- // Try to use a cached version first
48- if ( this . constructor . __imageCache && this . constructor . __imageCache [ iconPath ] ) {
49- this . setButtonContent ( this . constructor . __imageCache [ iconPath ] ) ;
51+ if ( this . __imageCache [ iconPath ] ) {
52+ this . setButtonContent ( this . __imageCache [ iconPath ] ) ;
5053 return ;
5154 }
5255
53- // Initialize cache if it doesn't exist
54- if ( ! this . constructor . __imageCache ) {
55- this . constructor . __imageCache = { } ;
56- }
57-
5856 // Fetch and convert to data URI for permanent caching
5957 fetch ( iconUrl )
6058 . then ( response => response . blob ( ) )
@@ -65,7 +63,7 @@ qx.Class.define("osparc.ui.table.cellrenderer.ImageButtonRenderer", {
6563 const content = `<img src="${ dataUri } " style="width:14px; height:14px;" alt="icon"/>` ;
6664
6765 // Cache the data URI
68- this . constructor . __imageCache [ iconPath ] = content ;
66+ this . __imageCache [ iconPath ] = content ;
6967 this . setButtonContent ( content ) ;
7068 } ;
7169 reader . readAsDataURL ( blob ) ;
0 commit comments