Skip to content

Commit 03b32db

Browse files
MahmoudMahmoud
Mahmoud
authored and
Mahmoud
committed
Fix type error when data is not available in Region component
1 parent ebef8fe commit 03b32db

File tree

1 file changed

+2
-2
lines changed
  • spotlight-client/src/charts/TopologicalMap

1 file changed

+2
-2
lines changed

spotlight-client/src/charts/TopologicalMap/Region.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import { geoCentroid } from "d3-geo";
1919
import React, { useState } from "react";
20-
import { Geography, Marker, GeographyProps } from "react-simple-maps";
20+
import { Geography, GeographyProps, Marker } from "react-simple-maps";
2121
import { Spring } from "react-spring/renderprops.cjs";
2222
import styled from "styled-components/macro";
2323
import { ValuesType } from "utility-types";
@@ -50,7 +50,7 @@ const Region = ({
5050
geography: GeographyProps["geography"];
5151
}): React.ReactElement => {
5252
const centroid = geoCentroid(geography);
53-
const { label, value } = data;
53+
const { label, value } = data || {};
5454
const [hoverRegion, setHoverRegion] = useState(false);
5555

5656
const setHover = () => {

0 commit comments

Comments
 (0)