The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
fix(places): tapping a phone search suggestion keeps the last pick's address and position
Maurice0bdf0fc34588
diff --git a/client/src/mobile/screens/trip/sheets/MPlaceEditSheet.tsx b/client/src/mobile/screens/trip/sheets/MPlaceEditSheet.tsxindex 0d5a3bdb0..4a2ca9ca3 100644--- a/client/src/mobile/screens/trip/sheets/MPlaceEditSheet.tsx+++ b/client/src/mobile/screens/trip/sheets/MPlaceEditSheet.tsx@@ -237,7 +237,13 @@ export default function MPlaceEditSheet({ planner, onOpenExpense }: MPlaceEditSh/><div className="min-h-0 flex-1 overflow-y-auto px-[18px] pb-[6px] pt-[2px]" onPaste={handlePaste}>- <PlPlaceSearch planner={planner} locationBias={locationBias} onPick={applyPick} onResolvingChange={setResolvingPick} />+ <PlPlaceSearch+ planner={planner}+ locationBias={locationBias}+ onPick={applyPick}+ onSuggestionName={name => setForm(prev => ({ ...prev, name }))}+ onResolvingChange={setResolvingPick}+ />{placesEnrichEnabled && (<div className="mt-3">diff --git a/client/src/mobile/screens/trip/sheets/PlPlaceSearch.tsx b/client/src/mobile/screens/trip/sheets/PlPlaceSearch.tsxindex e6486f62a..3271a8e20 100644--- a/client/src/mobile/screens/trip/sheets/PlPlaceSearch.tsx+++ b/client/src/mobile/screens/trip/sheets/PlPlaceSearch.tsx@@ -40,6 +40,12 @@ interface PlPlaceSearchProps {/** Search bias derived from the trip's existing places (trip centre). */locationBias?: { low: { lat: number; lng: number }; high: { lat: number; lng: number } }onPick: (pick: PlSearchPick) => void+ /**+ * A suggestion was tapped: only its name goes into the form while its place is+ * looked up, as on the desktop. Handing it over as a pick would clear every+ * field the previous pick filled, and a failed lookup would leave them empty.+ */+ onSuggestionName: (name: string) => void/** True while a suggestion's details are being resolved (name spinner). */onResolvingChange?: (resolving: boolean) => void}@@ -67,7 +73,7 @@ function placeToPick(place: MapsPlace): PlSearchPick {* detection — the mobile counterpart of PlaceFormModal's search block, on the* same search logic (usePlaceSearch).*/-export default function PlPlaceSearch({ planner, locationBias, onPick, onResolvingChange }: PlPlaceSearchProps) {+export default function PlPlaceSearch({ planner, locationBias, onPick, onSuggestionName, onResolvingChange }: PlPlaceSearchProps) {const { t, toast } = plannerconst {query, setQuery, results, suggestions, setSuggestions, acSource, searchSource, searching, googleAnswers,@@ -78,7 +84,7 @@ export default function PlPlaceSearch({ planner, locationBias, onPick, onResolvit,toast,onPlace: place => onPick(placeToPick(place)),- onSuggestionName: name => onPick({ name }),+ onSuggestionName,onMapLink: resolved => onPick({name: resolved.name || undefined,address: resolved.address || undefined,diff --git a/client/tests/unit/mobile/trip/MPlaceEditSheet.test.tsx b/client/tests/unit/mobile/trip/MPlaceEditSheet.test.tsxindex a19bc80e8..b4c05e383 100644--- a/client/tests/unit/mobile/trip/MPlaceEditSheet.test.tsx+++ b/client/tests/unit/mobile/trip/MPlaceEditSheet.test.tsx@@ -11,7 +11,7 @@ import { server } from '../../../helpers/msw/server'import { resetAllStores, seedStore } from '../../../helpers/store'import { fireEvent, render, screen, waitFor } from '../../../helpers/render'-// FE-MOB-PLEDIT-001 to FE-MOB-PLEDIT-045, plus the 009b, 025b and 029b variants+// FE-MOB-PLEDIT-001 to FE-MOB-PLEDIT-046, plus the 009b, 025b and 029b variants// planner.t echoes the key, so every label/placeholder is asserted as its key.const CATEGORIES = [@@ -227,6 +227,39 @@ describe('MPlaceEditSheet', () => {expect(planner.toast.warning).toHaveBeenCalledWith('places.duplicateExists:Ueno Park')})+ it('FE-MOB-PLEDIT-046: tapping a suggestion only puts its name in, so a failed lookup keeps the position of the last pick', async () => {+ let searches = 0+ server.use(+ http.post('/api/maps/search', () => {+ searches += 1+ return HttpResponse.json(searches === 1+ ? { source: 'osm', places: [{ name: 'Ueno Koen', address: 'Taito', lat: 35.7, lng: 139.7, website: 'https://ueno.example' }] }+ : { source: 'osm', places: [] })+ }),+ http.post('/api/maps/autocomplete', () => HttpResponse.json({+ source: 'osm', suggestions: [{ placeId: 'sug-46', mainText: 'Louvre', secondaryText: 'Paris' }],+ })),+ http.get('/api/maps/details/:placeId', () => HttpResponse.json({}, { status: 500 })),+ )+ const { planner } = setup()+ const search = screen.getByPlaceholderText('places.mapsSearchPlaceholder')+ fireEvent.change(search, { target: { value: 'ueno koen' } })+ fireEvent.click(screen.getByRole('button', { name: 'common.search' }))+ fireEvent.click(await screen.findByText('Ueno Koen'))+ expect(screen.getByPlaceholderText('places.formLat')).toHaveValue('35.7')++ fireEvent.change(search, { target: { value: 'Lou' } })+ fireEvent.click(await screen.findByText('Louvre'))+ await waitFor(() => expect(planner.toast.error).toHaveBeenCalledWith('places.mapsSearchError'))++ // The same as the desktop dialog: the name is the suggestion's, the rest is what the last pick wrote.+ expect(nameField()).toHaveValue('Louvre')+ expect(screen.getByPlaceholderText('places.formAddressPlaceholder')).toHaveValue('Taito')+ expect(screen.getByPlaceholderText('places.formLat')).toHaveValue('35.7')+ expect(screen.getByPlaceholderText('places.formLng')).toHaveValue('139.7')+ expect(screen.getByPlaceholderText('https://')).toHaveValue('https://ueno.example')+ })+it('FE-MOB-PLEDIT-017: an existing place never triggers the duplicate guard', async () => {const { planner } = setup({ places: [EXISTING], editingPlace: { ...EXISTING, id: 99 } as unknown as Place })fireEvent.click(submit())diff --git a/client/tests/unit/mobile/trip/PlPlaceSearch.test.tsx b/client/tests/unit/mobile/trip/PlPlaceSearch.test.tsxindex 951620b0a..f6c781768 100644--- a/client/tests/unit/mobile/trip/PlPlaceSearch.test.tsx+++ b/client/tests/unit/mobile/trip/PlPlaceSearch.test.tsx@@ -61,13 +61,14 @@ function recordGoogleRetry() {function setup(plannerOverrides: Partial<TripPlanner> = {}, locationBias?: Parameters<typeof PlPlaceSearch>[0]['locationBias']) {const onPick = vi.fn()+ const onSuggestionName = vi.fn()const onResolvingChange = vi.fn()const planner = buildPlanner(plannerOverrides)const view = render(- <PlPlaceSearch planner={planner} locationBias={locationBias} onPick={onPick} onResolvingChange={onResolvingChange} />,+ <PlPlaceSearch planner={planner} locationBias={locationBias} onPick={onPick} onSuggestionName={onSuggestionName} onResolvingChange={onResolvingChange} />,)const input = screen.getByPlaceholderText('places.mapsSearchPlaceholder')- return { ...view, planner, onPick, onResolvingChange, input }+ return { ...view, planner, onPick, onSuggestionName, onResolvingChange, input }}describe('PlPlaceSearch', () => {@@ -110,7 +111,7 @@ describe('PlPlaceSearch', () => {recordAutocomplete(),http.get('/api/maps/details/:placeId', () => HttpResponse.json({ place: LOUVRE })),)- const { input, onPick } = setup()+ const { input, onPick, onSuggestionName } = setup()fireEvent.change(input, { target: { value: 'Lou' } })const row = await screen.findByText('Louvre')// The row swallows pointerdown so the field's blur handler cannot close@@ -119,9 +120,9 @@ describe('PlPlaceSearch', () => {expect(pointerDown).toBe(false)fireEvent.click(row)- // Optimistic name first, then the full record.- expect(onPick).toHaveBeenNthCalledWith(1, { name: 'Louvre' })- await waitFor(() => expect(onPick).toHaveBeenCalledTimes(2))+ // Optimistic name first, on its own, then the full record.+ expect(onSuggestionName).toHaveBeenCalledWith('Louvre')+ await waitFor(() => expect(onPick).toHaveBeenCalledTimes(1))expect(onPick).toHaveBeenLastCalledWith({name: 'Louvre Museum',address: 'Rue de Rivoli, Paris',@@ -149,7 +150,7 @@ describe('PlPlaceSearch', () => {fireEvent.change(input, { target: { value: 'Lou' } })fireEvent.click(await screen.findByText('Louvre'))- await waitFor(() => expect(onPick).toHaveBeenCalledTimes(2))+ await waitFor(() => expect(onPick).toHaveBeenCalledTimes(1))expect(searchBodies[0]).toEqual({ query: 'Louvre, Paris, France' })expect(onPick).toHaveBeenLastCalledWith(expect.objectContaining({ name: 'Louvre Museum', lat: '48.8606' }))})@@ -174,7 +175,7 @@ describe('PlPlaceSearch', () => {fireEvent.change(input, { target: { value: 'Tok' } })fireEvent.click(await screen.findByText('Tokio Hauptbahnhof'))- await waitFor(() => expect(onPick).toHaveBeenCalledTimes(2))+ await waitFor(() => expect(onPick).toHaveBeenCalledTimes(1))expect(searchBodies).toHaveLength(0)expect(onPick).toHaveBeenLastCalledWith(expect.objectContaining({name: 'Tokio Hauptbahnhof', lat: '35.6811816', lng: '139.76598265',@@ -543,7 +544,7 @@ describe('PlPlaceSearch plugin search (#2221)', () => {const { input, onPick } = setup()fireEvent.change(input, { target: { value: 'Ichi' } })fireEvent.click(await screen.findByText('Ichiran Ueno'))- await waitFor(() => expect(onPick).toHaveBeenCalledTimes(2))+ await waitFor(() => expect(onPick).toHaveBeenCalledTimes(1))expect(onPick).toHaveBeenLastCalledWith(expect.objectContaining({name: 'Ichiran Ueno', address: 'Ueno 6-11-12, Taito', lat: '35.7101', lng: '139.7745',osm_id: 'plugin:all-the-places:ichiran-ueno', website: 'https://ichiran.com/shop/ueno',