fix for performance optimizations

This commit is contained in:
overcuriousity 2025-09-22 15:37:33 +02:00
parent 52ea7acf04
commit 5d1d249910

View File

@ -74,6 +74,7 @@ class GraphManager {
// Manual refresh button for polling optimization // Manual refresh button for polling optimization
this.manualRefreshButton = null; this.manualRefreshButton = null;
this.manualRefreshHandler = null; // Store the handler
this.options = { this.options = {
nodes: { nodes: {
@ -284,6 +285,10 @@ class GraphManager {
// Manual refresh button - handler will be set by main app // Manual refresh button - handler will be set by main app
this.manualRefreshButton = document.getElementById('graph-manual-refresh'); this.manualRefreshButton = document.getElementById('graph-manual-refresh');
// If a handler was set before the button existed, attach it now
if (this.manualRefreshButton && this.manualRefreshHandler) {
this.manualRefreshButton.addEventListener('click', this.manualRefreshHandler);
}
} }
/** /**
@ -291,6 +296,8 @@ class GraphManager {
* @param {Function} handler - Function to call when manual refresh is clicked * @param {Function} handler - Function to call when manual refresh is clicked
*/ */
setManualRefreshHandler(handler) { setManualRefreshHandler(handler) {
this.manualRefreshHandler = handler;
// If the button already exists, attach the handler
if (this.manualRefreshButton && typeof handler === 'function') { if (this.manualRefreshButton && typeof handler === 'function') {
this.manualRefreshButton.addEventListener('click', handler); this.manualRefreshButton.addEventListener('click', handler);
} }