JS Version 1.3.0 Release

Bug Fixes :bug:

To combat unnecessarily slow experiences, we’ve added two new defaults to all components that handle geolocation (SearchBar, LocationBias and the GeoLocationFilter).

  1. maximumAge. This controls how long geolocation information can be cached. Its previous default was 0, which meant our experiences could not “use a cached position and must attempt to retrieve the real current position” on every near me search. It has been updated to 5 minutes for SearchBar, LocationBias and the GeoLocationFilter.
  2. timeout. This sets a limit for how long the experience will wait for geolocation information to return. Its previous default was Infinity, which meant our experiences would wait until geolocation information returned before showing results. It has been updated to 1 second for the SearchBar, 6 seconds for LocationBias and the GeoLocationFilter.

Updates :man_cartwheeling:

In addition to the above fixes we’ve added more geolocation configuration options to the SearchBar, LocationBias and the GeoLocationFilter. These can be added under the relevant component in the componentSettings in your json config file.

  • The geolocationOptions configuration allow to control timeout and maximumAge (described above), in addition to enableHighAccuracy.
  • The geolocationTimeoutAlert configuration allows you to display a native window.alert() when a geolocation call times out. This defaults to off, but maybe useful for clients wanting to add additional transparency around geolocation failures.
  componentSettings: {
   SearchBar: {
     geolocationOptions: {
        // Optional, whether to improve accuracy at the cost of response time and/or power consumption, defaults to false.
        enableHighAccuracy: false,
        // Optional, the maximum amount of time (in ms) a geolocation call is allowed to take before defaulting, defaults to 1 second.
        timeout: 1000,
        // Optional, the maximum amount of time (in ms) to cache a geolocation call, defaults to 5 minutes.
        maximumAge: 300000,
      // Optional, options for an alert when the geolocation call fails.
      geolocationTimeoutAlert: {
        // Optional, whether to display a window.alert() on the page, defaults to false.
        enabled: false,
        // Optional, the message in the alert. Defaults to the below
        message: "We are unable to determine your location"

Breaking Changes :warning:

None, but note the new defaults on geolocation described in the bug fixes section.