Try to prevent race with data loading
This commit is contained in:
parent
a5e2c4a8c8
commit
7983e0d30b
@ -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]);
|
||||||
|
Loading…
Reference in New Issue
Block a user