diff --git a/src/components/SearchMap/SearchMap.js b/src/components/SearchMap/SearchMap.js index 84b055c783..cf1ac5434e 100644 --- a/src/components/SearchMap/SearchMap.js +++ b/src/components/SearchMap/SearchMap.js @@ -205,7 +205,7 @@ export class SearchMapComponent extends Component { this.onListingClicked = this.onListingClicked.bind(this); this.onMapClicked = this.onMapClicked.bind(this); this.onMapLoadHandler = this.onMapLoadHandler.bind(this); - this.forceUpdateHandler = this.forceUpdateHandler.bind(this); + //this.forceUpdateHandler = this.forceUpdateHandler.bind(this); } componentWillReceiveProps(nextProps) { @@ -225,9 +225,9 @@ export class SearchMapComponent extends Component { this.listings = []; } - forceUpdateHandler() { - this.forceUpdate(); - } + // forceUpdateHandler() { + // this.forceUpdate(); + // } createURLToListing(listing) { const routes = routeConfiguration(); @@ -297,37 +297,46 @@ export class SearchMapComponent extends Component { const isMapsLibLoaded = typeof window !== 'undefined' && window.google && window.google.maps; + const mapComponent = isMapsLibLoaded + ? ( + } + mapElement={
} + center={center} + isOpenOnModal={isOpenOnModal} + listings={listings} + activeListingId={activeListingId} + infoCardOpen={infoCardOpen} + onListingClicked={this.onListingClicked} + onListingInfoCardClicked={this.onListingInfoCardClicked} + createURLToListing={this.createURLToListing} + onMapLoad={this.onMapLoadHandler} + onIdle={() => { + if (this.googleMap) { + onIdle(this.googleMap); + } + }} + onCloseAsModal={() => { + if (onCloseAsModal) { + onCloseAsModal(); + } + }} + zoom={zoom} + /> + ) + : null; + + const forceUpdateHandler = () => { + mapComponent.forceUpdate(); + } // container element listens clicks so that opened SearchMapInfoCard can be closed /* eslint-disable jsx-a11y/no-static-element-interactions */ return isMapsLibLoaded ? ( - } - mapElement={
} - center={center} - isOpenOnModal={isOpenOnModal} - listings={listings} - activeListingId={activeListingId} - infoCardOpen={infoCardOpen} - onListingClicked={this.onListingClicked} - onListingInfoCardClicked={this.onListingInfoCardClicked} - createURLToListing={this.createURLToListing} - onMapLoad={this.onMapLoadHandler} - onIdle={() => { - if (this.googleMap) { - onIdle(this.googleMap); - } - }} - onCloseAsModal={() => { - if (onCloseAsModal) { - onCloseAsModal(); - } - }} - zoom={zoom} - /> + {mapComponent} ) : (