Commit 94419ade authored by vertighel's avatar vertighel
Browse files

fix: dependency-guard — ri-applica guard camere dopo fetch /api/cameras



Il fetch era asincrono e arrivava dopo il primo state-diff WS.
Dopo aver popolato ROOTS, itera endpointStates già ricevuti
e chiama applyGuard per ogni cam_id appena aggiunto.

Co-Authored-By: default avatarClaude Sonnet 4.6 <noreply@anthropic.com>
parent 6ce0f52f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -85,5 +85,10 @@ fetch('/api/cameras')
        for (const [cam_id, cfg] of Object.entries(cameras)) {
            ROOTS[cam_id] = cfg.power_api ?? null;
        }
        for (const [cam_id, rootPath] of Object.entries(ROOTS)) {
            if (rootPath && cam_id in cameras) {
                applyGuard(cam_id, endpointStates[rootPath] === false);
            }
        }
    })
    .catch(() => {});