From a1a3a52dd8a22a6c949373c3b67f5e3041b8283d Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Mon, 11 May 2026 23:21:50 -0400 Subject: [PATCH] Fix empty-object false negative in links page no-data check The check `!data.hosts && !data.unifi_switches` never caught empty objects `{}`, which are truthy. Replace with Object.keys length checks so the friendly "no data yet" banner renders when both collections are empty. Co-Authored-By: Claude Sonnet 4.6 --- templates/links.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/links.html b/templates/links.html index 7d4df9f..9d3a978 100644 --- a/templates/links.html +++ b/templates/links.html @@ -548,7 +548,7 @@ function checkLinksStale(updatedStr) { async function loadLinks() { try { const data = await lt.api.get('/api/links'); - if (!data.hosts && !data.unifi_switches) { + if ((!data.hosts || !Object.keys(data.hosts).length) && (!data.unifi_switches || !Object.keys(data.unifi_switches).length)) { document.getElementById('links-container').innerHTML = ''; return;