From 4d6916e7075bc9c6a322e48f0bdd7cbbc9977284 Mon Sep 17 00:00:00 2001 From: Tim Dykes Date: Tue, 17 Jul 2018 09:51:20 +1000 Subject: [PATCH] race condition on map render (#538) --- client/src/screens/events/Detail.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/client/src/screens/events/Detail.js b/client/src/screens/events/Detail.js index 34173455..224a6b32 100644 --- a/client/src/screens/events/Detail.js +++ b/client/src/screens/events/Detail.js @@ -224,18 +224,20 @@ class Detail extends Component { } zoomMap(fitToTheseCoordinates) { - this.map.fitToCoordinates( - fitToTheseCoordinates, - { - edgePadding: { - top: 300, - right: 100, - bottom: 300, - left: 100, + if (fitToTheseCoordinates.length) { + this.map.fitToCoordinates( + fitToTheseCoordinates, + { + edgePadding: { + top: 300, + right: 100, + bottom: 300, + left: 100, + }, + animated: true, }, - animated: true, - }, - ); + ); + } } zoomToRegionMap(fitToTheseCoordinates) {