mapbox / mapbox-sdk-js

A JavaScript client to Mapbox services, supporting Node, browsers, and React Native
Other
719 stars 186 forks source link

Correctly handle arrays containing zero values in appendQueryObject #362

Closed sheridanvk closed 4 years ago

sheridanvk commented 4 years ago

Hi there - I ran into a bug when I tried to use a MapboxGeocoder object on a map initialised to a point in London (lng: 0, lat: 51.5). It turned out that after fixing that issue (draft PR here: https://github.com/mapbox/mapbox-gl-geocoder/pull/350) there was also a similar bug in the request that the geocoder triggered from this SDK. I believe this PR will solve it, but please let me know if I should do anything differently here!

Without the change I added, appendQueryObject returns ?proximity=51.5, which breaks because proximity expects an input with two values, not one. With the change, it correctly returns ?proximity=0%2C51.5.