mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-28 07:30:04 +00:00
fix(mobile): search a map link shared while the add-place sheet is already open
The shared link is put in the field and searched as given, instead of whatever the field held when the sheet opened.
This commit is contained in:
@@ -268,11 +268,12 @@ export function usePlaceSearch({
|
||||
const pickPlace = (place: MapsPlace, pick?: PlaceSearchPick) =>
|
||||
take(place, pick, sourceLabel(place, pick?.mode === 'search' ? searchSource : ''));
|
||||
|
||||
const runSearch = async (provider?: 'google') => {
|
||||
const runSearch = async (provider?: 'google', text?: string) => {
|
||||
// The retry sends the query the list came from, not the field: the list
|
||||
// stays on screen while the field is edited or cleared, and the line under
|
||||
// it promises the same query.
|
||||
const trimmed = provider ? (searchMetaRef.current?.query ?? '') : query.trim();
|
||||
// it promises the same query. A link shared into an open sheet is searched
|
||||
// as given, before the field shows it.
|
||||
const trimmed = provider ? (searchMetaRef.current?.query ?? '') : (text ?? query).trim();
|
||||
if (!trimmed) return;
|
||||
if (sheet) {
|
||||
setSuggestions([]);
|
||||
|
||||
Reference in New Issue
Block a user