From d767f687cada9ea0346f167bca8ce2da3dba561f Mon Sep 17 00:00:00 2001 From: "courtmanr@gmail.com" Date: Fri, 30 May 2025 11:57:18 +0100 Subject: [PATCH] fix: eliminate dashboard initialization error on first load - Make updateDashboardTable gracefully handle uninitialized elements - Try to find elements if not already cached - Silently return instead of logging error during initial page load This prevents the 'Dashboard table body or status element not found' error when the socket connection updates arrive before DOM is ready. --- src/public/js/ui/dashboard.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/public/js/ui/dashboard.js b/src/public/js/ui/dashboard.js index 895952680..71d8b5d6b 100644 --- a/src/public/js/ui/dashboard.js +++ b/src/public/js/ui/dashboard.js @@ -696,9 +696,15 @@ PulseApp.ui.dashboard = (() => { let previousGroupByNode = null; function updateDashboardTable() { + // If elements aren't initialized yet, try to initialize them if (!tableBodyEl || !statusElementEl) { - console.error('Dashboard table body or status element not found/initialized!'); - return; + tableBodyEl = document.querySelector('#main-table tbody'); + statusElementEl = document.getElementById('dashboard-status-text'); + + // If still not found, silently return (not an error during initial load) + if (!tableBodyEl || !statusElementEl) { + return; + } } // Find the scrollable container