Fix: fuzzy location did not change after listing location changed.

This commit is contained in:
Vesa Luusua 2018-09-14 14:56:34 +03:00
parent 767c4c7e84
commit c66f358aec
2 changed files with 5 additions and 2 deletions

View file

@ -79,7 +79,9 @@ const reducedToArray = mapListings => {
const withCoordinatesObfuscated = listings => {
return listings.map(listing => {
const { id, attributes, ...rest } = listing;
const geolocation = obfuscatedCoordinates(attributes.geolocation, id ? id.uuid : null);
const origGeolocation = attributes.geolocation;
const cacheKey = id ? `${id.uuid}_${origGeolocation.lat}_${origGeolocation.lng}` : null;
const geolocation = obfuscatedCoordinates(origGeolocation, cacheKey);
return {
id,
...rest,

View file

@ -24,9 +24,10 @@ class SectionMapMaybe extends Component {
const address = publicData.location ? publicData.location.address : '';
const classes = classNames(rootClassName || css.sectionMap, className);
const cacheKey = listingId ? `${listingId.uuid}_${geolocation.lat}_${geolocation.lng}` : null;
const mapProps = config.maps.fuzzy.enabled
? { obfuscatedCenter: obfuscatedCoordinates(geolocation, listingId ? listingId.uuid : null) }
? { obfuscatedCenter: obfuscatedCoordinates(geolocation, cacheKey) }
: { address, center: geolocation };
const map = <Map {...mapProps} useStaticMap={this.state.isStatic} />;