Browse Source

fix(discover): Minicard should not crash on empty results (#26454)

Getting a colour palette for 0 items results in `undefined` which crashes with
a TypeError.
Tony Xiao 3 years ago
parent
commit
4923598f80
1 changed files with 3 additions and 1 deletions
  1. 3 1
      static/app/views/eventsV2/miniGraph.tsx

+ 3 - 1
static/app/views/eventsV2/miniGraph.tsx

@@ -194,7 +194,9 @@ class MiniGraph extends React.Component<Props> {
           }));
 
           const chartOptions = {
-            colors: [...theme.charts.getColorPalette(allSeries.length - 2)],
+            colors: allSeries.length
+              ? [...theme.charts.getColorPalette(allSeries.length - 2)]
+              : undefined,
             height: 100,
             series: [...data],
             xAxis: {