Skip to content

Commit 71edfa4

Browse files
committed
Adding check and default to legend component
1 parent 05051e2 commit 71edfa4

File tree

1 file changed

+6
-2
lines changed
  • x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle

1 file changed

+6
-2
lines changed

x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/legend.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ import {
1717
import { GradientLegend } from './gradient_legend';
1818
import { LegendControls } from './legend_controls';
1919
import { StepLegend } from './steps_legend';
20-
import { useWaffleOptionsContext, WaffleLegendOptions } from '../../hooks/use_waffle_options';
20+
import {
21+
DEFAULT_LEGEND,
22+
useWaffleOptionsContext,
23+
WaffleLegendOptions,
24+
} from '../../hooks/use_waffle_options';
2125
import { SteppedGradientLegend } from './stepped_gradient_legend';
2226
interface Props {
2327
legend: InfraWaffleMapLegend;
@@ -52,7 +56,7 @@ export const Legend: React.FC<Props> = ({ dataBounds, legend, bounds, formatter
5256
return (
5357
<LegendContainer>
5458
<LegendControls
55-
options={legendOptions}
59+
options={legendOptions != null ? legendOptions : DEFAULT_LEGEND}
5660
dataBounds={dataBounds}
5761
bounds={bounds}
5862
autoBounds={autoBounds}

0 commit comments

Comments
 (0)