Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Add guard in ChartHandler https://sentry.io/organizations/supabase/issues/2821524162

Joshen Lim5f641e611b0f
diff --git a/studio/components/to-be-cleaned/Charts/ChartHandler.tsx b/studio/components/to-be-cleaned/Charts/ChartHandler.tsx
index 2588c11ad6b..ccfcbfa6bf9 100644
--- a/studio/components/to-be-cleaned/Charts/ChartHandler.tsx
+++ b/studio/components/to-be-cleaned/Charts/ChartHandler.tsx
@@ -86,12 +86,14 @@ const ChartHandler: FC<Props> = ({
// Convert null values to 0
// TODO: Chart endpoint should handle this data formatting to 0 instead of client.
- const formattedChartData = res.data.map((dataPoint: Dictionary<any>, idx: number) => {
- return {
- ...dataPoint,
- [attribute]: dataPoint[attribute] ? Number(dataPoint[attribute]) : 0,
+ const formattedChartData = (res?.data ?? []).map(
+ (dataPoint: Dictionary<any>, idx: number) => {
+ return {
+ ...dataPoint,
+ [attribute]: dataPoint[attribute] ? Number(dataPoint[attribute]) : 0,
+ }
}
- })
+ )
if (!cancel) {
setFetchedData({ ...res, data: formattedChartData })