From 07e99768e6b2a3cc6f75799f851542fa8fe59f14 Mon Sep 17 00:00:00 2001 From: Ben Phelps Date: Mon, 3 Oct 2022 10:45:45 +0300 Subject: [PATCH] speedtest widget, catch api errors --- src/widgets/speedtest/component.jsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/widgets/speedtest/component.jsx b/src/widgets/speedtest/component.jsx index 778d31c50..e93c69637 100644 --- a/src/widgets/speedtest/component.jsx +++ b/src/widgets/speedtest/component.jsx @@ -11,7 +11,7 @@ export default function Component({ service }) { const { data: speedtestData, error: speedtestError } = useWidgetAPI(widget, "speedtest/latest"); - if (speedtestError) { + if (speedtestError || (speedtestData && !speedtestData.data)) { return ; } @@ -31,10 +31,7 @@ export default function Component({ service }) { label="speedtest.download" value={t("common.bitrate", { value: speedtestData.data.download * 1024 * 1024 })} /> - +