diff --git a/frontend/src/components/WorldMap.tsx b/frontend/src/components/WorldMap.tsx index 1b3b9f7..5cd4c59 100644 --- a/frontend/src/components/WorldMap.tsx +++ b/frontend/src/components/WorldMap.tsx @@ -83,6 +83,12 @@ function GeoLayer({ [selectedCountry, onSelectCountry], ); + // react-simple-maps types declare `path` as always defined, but it is + // undefined during early renders before the MapProvider context initialises. + // Cast through unknown to reflect the true runtime type and guard safely. + const safePath = path as unknown as typeof path | null; + if (safePath == null) return <>; + return ( <> {(geographies as { rsmKey: string; id: string | number }[]).map(