diff --git a/handlers/dashboard.go b/handlers/dashboard.go index c1839fb05d..ece52d5eea 100644 --- a/handlers/dashboard.go +++ b/handlers/dashboard.go @@ -988,7 +988,8 @@ func DashboardDataEffectiveness(w http.ResponseWriter, r *http.Request) { } if len(activeValidators) == 0 { - http.Error(w, "Invalid query", http.StatusBadRequest) + // valid 200 response with empty data + w.Write([]byte(`{}`)) return } diff --git a/static/js/dashboard.js b/static/js/dashboard.js index 4e6a4ed208..b22eb2e135 100644 --- a/static/js/dashboard.js +++ b/static/js/dashboard.js @@ -976,6 +976,9 @@ $(document).ready(function () { method: "GET", }).then((res) => { res.json().then((data) => { + if (Object.keys(data).length === 0) { + return + } let sum = 0.0 for (let eff of data) { sum += eff