From 7983e0d30b32845099080892446c6a13d1354777 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Sun, 23 Jan 2022 12:34:59 -0500 Subject: [PATCH] Try to prevent race with data loading --- components/Map.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/Map.tsx b/components/Map.tsx index 5a936c7..99585b3 100644 --- a/components/Map.tsx +++ b/components/Map.tsx @@ -73,7 +73,7 @@ const Map: React.FC = () => { }); useEffect(() => { - if (!map.current || !data) return; // wait for map to initialize and data to load + if (!data) return; // wait for map to initialize and data to load map.current.on("load", () => { const zoom = map.current.getZoom(); const viewportNW = map.current.project([-180, 85.051129]);