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 <noreply@anthropic.com>
This commit is contained in:
@@ -548,7 +548,7 @@ function checkLinksStale(updatedStr) {
|
|||||||
async function loadLinks() {
|
async function loadLinks() {
|
||||||
try {
|
try {
|
||||||
const data = await lt.api.get('/api/links');
|
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 =
|
document.getElementById('links-container').innerHTML =
|
||||||
'<div class="link-no-data">No link data yet — monitor has not completed a full cycle.</div>';
|
'<div class="link-no-data">No link data yet — monitor has not completed a full cycle.</div>';
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user