Skip to content

Commit

Permalink
fix: revert add handling of lat, lon coordinate queries (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
gjvoosten authored Oct 19, 2023
1 parent 036eb33 commit 93c8a0c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 38 deletions.
17 changes: 2 additions & 15 deletions src/SearchControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ControlPosition, FeatureGroup, MarkerOptions, Map } from 'leaflet';
import SearchElement from './SearchElement';
import ResultList from './resultList';
import debounce from './lib/debounce';
import { validateCoords } from './coords';

import {
createElement,
Expand Down Expand Up @@ -374,13 +373,7 @@ const Control: SearchControl = {
const { provider } = this.options;

if (query.length) {
let results = [];
const coords = validateCoords(query);
if (coords) {
results = coords;
} else {
results = await provider!.search({ query });
}
let results = await provider!.search({ query });

Check warning on line 376 in src/SearchControl.ts

View workflow job for this annotation

GitHub Actions / Eslint

Forbidden non-null assertion
results = results.slice(0, this.options.maxSuggestions);
this.resultList.render(results, this.options.resultFormat);
} else {
Expand All @@ -392,13 +385,7 @@ const Control: SearchControl = {
this.resultList.clear();
const { provider } = this.options;

let results = [];
const coords = validateCoords(query);
if (coords) {
results = coords;
} else {
results = await provider!.search(query);
}
const results = await provider!.search(query);

Check warning on line 388 in src/SearchControl.ts

View workflow job for this annotation

GitHub Actions / Eslint

Forbidden non-null assertion

if (results && results.length > 0) {
this.showResult(results[0], query);
Expand Down
23 changes: 0 additions & 23 deletions src/coords.ts

This file was deleted.

0 comments on commit 93c8a0c

Please sign in to comment.