fix: use SuperJSON for cache persistence and add null guards to all widgets

SuperJSON preserves Date/Map/Set types through the Redis cache round-trip,
fixing RangeError crashes from date formatting. Added defensive null/undefined
guards across all widget components to handle useQuery loading states and
potential cache shape mismatches.
This commit is contained in:
Thomas Camlong committed 2026-07-04 10:19:16 +02:00
1 parent e20053b2c1
commit cf075040e8
31 files changed
+124 -117

No files matched your search

+3 -2
View File
@@ -35,8 +35,9 @@ export default function StockPriceWidget({ options, width, height }: WidgetCompo
calculateChangePercentage(data.priceHistory.at(-1) ?? 0, data.previousClose),
);
const stockValuesMin = Math.min(...data.priceHistory);
const stockGraphValues = data.priceHistory.map((value) => value - stockValuesMin + 50);
const priceHistory = data.priceHistory ?? [];
const stockValuesMin = priceHistory.length > 0 ? Math.min(...priceHistory) : 0;
const stockGraphValues = priceHistory.map((value) => value - stockValuesMin + 50);
const trendColor = stockValuesChange > 0 ? "green.7" : stockValuesChange < 0 ? "red.7" : "gray.6";
return (