mapbox / mapbox/mapbox-gl-geocoder

error: query must be an array with 2 items

Open
#505 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug
Dominant language
JavaScript
Stars
388
Forks
181
PR merge metrics
No merged PRs in 30d

Description

Using reverse coding if there is a space at the beginning or end of coordinates throws this error.

Solution: Trim whitespaces on input

![Screenshot 2023-08-07 154949](https://github.com/mapbox/mapbox-gl-geocoder/assets/2220160/91fecce0-6e15-46b8-89e7-942f3ce8fa8d)

![Screenshot2 2023-08-07 154949](https://github.com/mapbox/mapbox-gl-geocoder/assets/2220160/fe229dd4-e2aa-412b-b80a-a81243215f78)

The same thing happens on the example page. https://docs.mapbox.com/mapbox-gl-js/example/mapbox-gl-geocoder-accept-coordinates/

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reverse-coordinate search with leading and trailing spaces on the linked Mapbox GL JS example page, then trace the coordinate-query input handling in the plugin. Done means whitespace around valid coordinates no longer causes the “query must be an array with 2 items” error and the example behaves correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.