forked from MapComplete/MapComplete
UX: search doesn't eternally spin anymore, add debug name for searchProviders
This commit is contained in:
parent
d00ccc9282
commit
1ecc63e5c8
10 changed files with 14 additions and 13 deletions
|
|
@ -8,7 +8,7 @@ export default class OpenLocationCodeSearch implements GeocodingProvider {
|
|||
*/
|
||||
public static readonly _isPlusCode =
|
||||
/^([2-9CFGHJMPQRVWX]{2}|00){2,4}\+([2-9CFGHJMPQRVWX]{2,3})?$/
|
||||
|
||||
public readonly name = "OpenLocationCodeSearch"
|
||||
/**
|
||||
*
|
||||
* OpenLocationCodeSearch.isPlusCode("9FFW84J9+XG") // => true
|
||||
|
|
@ -26,7 +26,7 @@ export default class OpenLocationCodeSearch implements GeocodingProvider {
|
|||
|
||||
async search(query: string, options?: GeocodingOptions): Promise<GeocodeResult[]> {
|
||||
if (!OpenLocationCodeSearch.isPlusCode(query)) {
|
||||
return undefined
|
||||
return [] // Must be an empty list and not "undefined", the latter is interpreted as 'still searching'
|
||||
}
|
||||
const { latitude, longitude } = pluscode_decode(query)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue