Try to prevent race with data loading

This commit is contained in:
Tyler Hallada 2022-01-23 12:34:59 -05:00
parent a5e2c4a8c8
commit 7983e0d30b

View File

@ -73,7 +73,7 @@ const Map: React.FC = () => {
}); });
useEffect(() => { 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", () => { map.current.on("load", () => {
const zoom = map.current.getZoom(); const zoom = map.current.getZoom();
const viewportNW = map.current.project([-180, 85.051129]); const viewportNW = map.current.project([-180, 85.051129]);