googlemaps / googlemaps/react-native-navigation-sdk

[Bug]: cmd+s or a save in vscode/cursor loses the route overview from state after showRouteOverview

Open
#591 1 comment 0 reactions 1 assignee Claimed by @jokerttu View on GitHub
priority: p2 type: bug
Dominant language
TypeScript
Stars
227
Forks
38
Avg merge
5d 7h
Merged PRs (30d)
10

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Description of the bug

When developing, after I have created a route, setDestination and called showRouteOverview() it successfully animates the camera and does work.

However, when I make changes to the code in my editor and I press cmd + s the route dissapears and is not recoverable without restarting the app to load the state from scratch

### React Native version

0.82

### React version

19.2.0

### Package version

0.15.2

### Native SDK versions

- [x] I haven't changed the version of the native SDKs

### React Native Doctor Output

Common
✓ Node.js - Required to execute JavaScript code
✓ yarn - Required to install NPM dependencies
✓ npm - Required to install NPM dependencies
✓ Watchman - Used for watching changes in the filesystem when in development mode
✓ Metro - Required for bundling the JavaScript code

Android
✓ Adb - Required to verify if the android device is attached correctly
✓ JDK - Required to compile Java code
✓ Android Studio - Required for building and installing your app on Android
✓ ANDROID_HOME - Environment variable that points to your Android SDK installation
✓ Gradlew - Build tool required for Android builds
✓ Android SDK - Required for building and installing your app on Android

iOS
✓ Xcode - Required for building and installing your app on iOS
✓ Ruby - Required for installing iOS dependencies
✓ CocoaPods - Required for installing iOS dependencies
✓ .xcode.env - File to customize Xcode environment

Errors: 0
Warnings: 0

### Steps to reproduce

1. Create a NavigationView
2. With the controller add a destination and ensure the map is initialized
3. Invoke showRouteOverview() to expect the map to show a top view of the map and fit to coordinates
4. Press cmd + s or conduct a state change from a button within the same component as the NavigationView
5. The blue route will disappear along with the suggested routes

### Expected vs Actual Behavior

Expected behaviour is for the route to remain in state
Actual behaviour is that its lost is state and one needs to restart the app or start again

### Code Sample

```javascript
const createRouteOverview = useCallback(
async (dest: Coordinate) => {
try {
await withRetry(async () => {
await ensureInitialized();
await setDestinationAndCache(dest);
});
navigationViewController?.showRouteOverview();
} catch (err: any) {
onErrorRef.current?.(toNavigationError(err));
}
},
[ensureInitialized, setDestinationAndCache, navigationViewController],
);
```

the above is not really related, because it doesnt really matter. The issue is the route is lost after one is created from saving the code. The re-render of the dev server is enough for it to lose state

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.