Skip to content

Fix iOS MapView not updating after trip location edit#1854

Draft
Copilot wants to merge 10 commits intodevelopmentfrom
copilot/fix-trip-location-update
Draft

Fix iOS MapView not updating after trip location edit#1854
Copilot wants to merge 10 commits intodevelopmentfrom
copilot/fix-trip-location-update

Conversation

Copy link
Contributor

Copilot AI commented Feb 27, 2026

On iOS, editing a trip's location doesn't update the Trip Detail screen map. The location data persists correctly, but MapView's initialRegion prop doesn't reactively update on navigation back.

Changes

  • TripDetailScreen: Force MapView remount when coordinates change

    const mapKey = useMemo(
      () => trip?.location 
        ? `map-${trip.location.latitude}-${trip.location.longitude}` 
        : 'map-no-location',
      [trip?.location?.latitude, trip?.location?.longitude]
    );
    
    <MapView key={mapKey} initialRegion={{...}} />
  • TripForm: Sync location store with trip data on mount, clear on unmount

    useEffect(() => {
      setLocation(trip?.location ?? null);
      return () => setLocation(null);
    }, [trip?.id, setLocation]);
  • tripLocationStore: Wrap setLocation in useCallback for stable reference

The key-based remount pattern forces React to recreate the MapView when coordinates change, bypassing initialRegion's one-time initialization behavior.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh gh auth status (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>iOS : Trips – Location Appears Updated in Edit Screen but Not Reflected in Trip Details</issue_title>
<issue_description>Description:
When editing a trip’s location and tapping "Update Trip", the trip overview screen does not reflect the updated location. The map remains unchanged.

However, when returning to the Edit Trip screen again, the location field placeholder shows the newly selected location.

Steps to Reproduce:

  1. Tap "Trips" from the bottom navigation bar
  2. Select any existing trip
  3. Tap Edit
  4. Change the location field
  5. Enter and select a valid location
  6. Tap "Update Trip"
  7. Return to the Trip Overview screen
  8. Observe location and map
  9. Go back into Edit again

Screen Recording:

ScreenRecording_02-25-2026.16-29-01_1.1.1.mp4

Expected Result:

  • The trip overview should display the updated location
  • The map should refresh to reflect the new location
  • The edit screen should match the overview

Actual Result:

  • The trip overview still shows the old location
  • The map does not update
  • Returning to the edit screen shows the new location in the input field

Environment:

  • Device: iOS

Note:
Works perfectly on Android</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 9 commits February 27, 2026 04:36
…mount

Co-authored-by: mikib0 <54102880+mikib0@users.noreply.github.com>
Co-authored-by: mikib0 <54102880+mikib0@users.noreply.github.com>
Co-authored-by: mikib0 <54102880+mikib0@users.noreply.github.com>
Co-authored-by: mikib0 <54102880+mikib0@users.noreply.github.com>
Co-authored-by: mikib0 <54102880+mikib0@users.noreply.github.com>
Co-authored-by: mikib0 <54102880+mikib0@users.noreply.github.com>
Co-authored-by: mikib0 <54102880+mikib0@users.noreply.github.com>
Co-authored-by: mikib0 <54102880+mikib0@users.noreply.github.com>
Co-authored-by: mikib0 <54102880+mikib0@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix location not updating in trip overview screen Fix iOS MapView not updating after trip location edit Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants