From 276edb20695cafcf651005217db165c77b76054c Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Thu, 13 Jul 2023 17:14:47 -0700 Subject: [PATCH] Better handle invalid coinmarketcap data --- src/widgets/coinmarketcap/component.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/widgets/coinmarketcap/component.jsx b/src/widgets/coinmarketcap/component.jsx index 554bb044f..2d51217ce 100644 --- a/src/widgets/coinmarketcap/component.jsx +++ b/src/widgets/coinmarketcap/component.jsx @@ -51,6 +51,9 @@ export default function Component({ service }) { const { data } = statsData; + // Make sure API returned valid data for the symbol + const validSymbols = symbols.filter(symbol => data[symbol].quote[currencyCode][`percent_change_${dateRange}`] !== null); + return (
@@ -58,7 +61,7 @@ export default function Component({ service }) {
- {symbols.map((symbol) => ( + {validSymbols.map((symbol) => (