Skip to content

Commit 6b83257

Browse files
committed
add optional chaining operator and check chart option before rendering
1 parent e1e57fc commit 6b83257

File tree

1 file changed

+3
-2
lines changed
  • app/[locale]/(user)/datasets/[datasetIdentifier]/components/Details

1 file changed

+3
-2
lines changed

app/[locale]/(user)/datasets/[datasetIdentifier]/components/Details/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const Details = () => {
6767
);
6868
}
6969

70-
return <ReactECharts option={item.chart.options} ref={chartRef} />;
70+
return <ReactECharts option={item?.chart?.options} ref={chartRef} />;
7171
};
7272

7373
return (
@@ -89,7 +89,8 @@ const Details = () => {
8989
<CarouselItem key={index} className="m-auto">
9090
<div className="w-full border-2 border-solid border-baseGraySlateSolid4 bg-surfaceDefault p-6 text-center shadow-basicLg max-sm:p-2">
9191
<div className="lg:p-10">
92-
{item.__typename === 'TypeResourceChart' ? (
92+
{item.__typename === 'TypeResourceChart' &&
93+
item?.chart?.options ? (
9394
renderChart(item)
9495
) : (
9596
<Image

0 commit comments

Comments
 (0)