Closed FonsecaDevs closed 2 years ago
Hi, When using functions instead variables on binds
eg: [file] side-navigation-menu.component.ts [sample]
private _items; get items() { console.error("ok"); if (!this._items) { this._items = navigation.map((item) => { if(item.path && !(/^\//.test(item.path))){ item.path = /${item.path}; } return { ...item, expanded: !this._compactMode } }); }
/${item.path}
return this._items;
}
when every click in body trigger this function many times, maybe when is low process is good, but if for example big menu maybe cause performance issue.
https://gyazo.com/c7441fdde966d768ff1a855bfd815d11
possible quickie fix
private _items; items = this.getitems(); getitems() { console.error("ok") if (!this._items) { this._items = navigation.map((item) => { if(item.path && !(/^\//.test(item.path))){ item.path = /${item.path}; } return { ...item, expanded: !this._compactMode } }); }
Thank you
Hi, When using functions instead variables on binds
eg: [file] side-navigation-menu.component.ts [sample]
private _items; get items() { console.error("ok"); if (!this._items) { this._items = navigation.map((item) => { if(item.path && !(/^\//.test(item.path))){ item.path =
/${item.path}
; } return { ...item, expanded: !this._compactMode } }); }}
when every click in body trigger this function many times, maybe when is low process is good, but if for example big menu maybe cause performance issue.
https://gyazo.com/c7441fdde966d768ff1a855bfd815d11
possible quickie fix
private _items; items = this.getitems(); getitems() { console.error("ok") if (!this._items) { this._items = navigation.map((item) => { if(item.path && !(/^\//.test(item.path))){ item.path =
/${item.path}
; } return { ...item, expanded: !this._compactMode } }); }}
Thank you