diff --git a/apps/www/registry/default/ui/chart.tsx b/apps/www/registry/default/ui/chart.tsx index 405448328c5..3d9f0809fa5 100644 --- a/apps/www/registry/default/ui/chart.tsx +++ b/apps/www/registry/default/ui/chart.tsx @@ -137,7 +137,7 @@ const ChartTooltipContent = React.forwardRef< } const [item] = payload - const key = `${labelKey || item.dataKey || item.name || "value"}` + const key = `${labelKey || item?.dataKey || item?.name || "value"}` const itemConfig = getPayloadConfigFromPayload(config, item, key) const value = !labelKey && typeof label === "string" diff --git a/apps/www/registry/new-york/ui/chart.tsx b/apps/www/registry/new-york/ui/chart.tsx index 405448328c5..3d9f0809fa5 100644 --- a/apps/www/registry/new-york/ui/chart.tsx +++ b/apps/www/registry/new-york/ui/chart.tsx @@ -137,7 +137,7 @@ const ChartTooltipContent = React.forwardRef< } const [item] = payload - const key = `${labelKey || item.dataKey || item.name || "value"}` + const key = `${labelKey || item?.dataKey || item?.name || "value"}` const itemConfig = getPayloadConfigFromPayload(config, item, key) const value = !labelKey && typeof label === "string"