Search as I move the map drops multi-value exposed filter values

Created on 16 March 2021, about 4 years ago
Updated 8 June 2024, 11 months ago

When using the “search as I move the map” feature alongside an exposed filter that accepts multiple values, if multiple values in this exposed filter are selected at the time you move the map, all but the last value are dropped when the view is refreshed and content is filtered on the last value only.

To reproduce:

  • Create a view with a geolocation common map display
  • In the display settings form, enable Update view on map boundary changes. Also known as "AirBnB" style.
  • Add an exposed filter for any field you have in your content type and check “allow multiple selections”
  • Enable ajax for the view
  • Create a page display
  • View the page, select 2 values in your exposed filter and submit the form
  • Results should display as expected (showing content for both selected values in your exposed filter)
  • Now move the map to trigger “search as I move the map”
  • You will see that only 1 (the last) value in your exposed filter is retained

If you open geolocation\modules\geolocation_google_maps\js\geolocation-common-map-google.js and console.log the value of ajaxSettings just before it submits the form, only one of the values selected in your exposed filter is passed back.

This doesn't only happen when you move the map, for some reason the bounds_changed event is triggered every time you change any exposed filter value and submit the form with ajax enabled. So if you select value 1 in your exposed filter and hit submit, then you add value 2 and submit the form again, instead of filtering on value 1 and value 2, it filters on only value 2. You'll notice that initially the correct results are returned, but after the delay configured in the view for “Minimum idle time in milliseconds required to trigger views refresh” the view updates and drops value 1.

So I think there are 2 related problems here; firstly the fact that filter values are dropped and secondly, the fact that the bounds_changed event is triggering when other view filters are changed. Presumably this second issue (bounds change trigger) is happening when the display is refreshed via ajax?

🐛 Bug report
Status

Fixed

Version

4.0

Component

GoogleMapsAPI

Created by

🇬🇧United Kingdom stox

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024