You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] Distance - App keep crashing after start GPS and switch to OD #80593
Version Number: v9.3.9-1 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:#79587 Email or phone of affected tester (no customers):applausetester+vq+260103@applause.expensifail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Pixel 7 Pro /Android 16 App Component: Money Requests
Action Performed:
Preconditions: Use the Expensifail account to have the beta enabled for GPS
Open the Hybrid app
Tap on the FAB
Select Track distance
Select GPS and allow the background running
Tap on the Account > Troubleshoot
Switch to OD
Tap on the App to open again
Expected Result:
The app should display a warning about GPS when switching between ND and OD
Actual Result:
Android: The app keeps crashing.
iOS: No warning when the user switches to OD and logs out, after that, can't log in to the iOS app again with the Magic code
changed the title [-]Distance - App keep crashing after start GPS and switch to OD[/-][+][$250] Distance - App keep crashing after start GPS and switch to OD[/+]on Jan 27, 2026
Restate the problem this issue is trying to solve.
When GPS distance tracking is active and the user switches from NewDot to OldDot using Troubleshoot, the app does not handle the transition safely. On Android, the app crashes in a loop after the switch. On iOS, no GPS warning is shown, and after logout the user cannot log back in with the magic code. The system allows a mode switch while GPS tracking is still active.
What is the root cause of that problem?
The root cause is an incorrect assumption in src/libs/actions/HybridApp/index.ts inside the closeReactNativeApp() function. The code assumes it is safe to close the React Native app without stopping GPS tracking or clearing GPS_DRAFT_DETAILS. This assumption is wrong because GPS tracking state can still be active. When the app closes with isTracking: true persisted in Onyx, the background GPS service continues to run. This creates inconsistent state that directly causes crashes on reopen and blocks login flows.
What changes do you think we should make in order to solve the problem?
Stop GPS tracking and clear GPS state before closing the React Native app.
Ensure GPS state is also cleared when returning from OldDot to NewDot.
Show a GPS warning modal before switching modes if GPS tracking is active.
File 1: src/libs/actions/HybridApp/index.ts
Add GPS cleanup in closeReactNativeApp() before closing the app.
importHybridAppModulefrom'@expensify/react-native-hybrid-app';importOnyxfrom'react-native-onyx';importNavigationfrom'@libs/Navigation/Navigation';import{resetGPSDraftDetails,setIsTracking}from'@libs/actions/GPSDraftDetails';importCONFIGfrom'@src/CONFIG';importONYXKEYSfrom'@src/ONYXKEYS';importtype{HybridApp}from'@src/types/onyx';importtypeHybridAppSettingsfrom'./types';// ... existing code ...functioncloseReactNativeApp({shouldSetNVP}: {shouldSetNVP: boolean}){Navigation.clearPreloadedRoutes();// Stop GPS tracking and clean up GPS tracking state before switching modessetIsTracking(false);resetGPSDraftDetails();if(CONFIG.IS_HYBRID_APP){Onyx.merge(ONYXKEYS.HYBRID_APP,{closingReactNativeApp: true});}// eslint-disable-next-line no-restricted-propertiesHybridAppModule.closeReactNativeApp({shouldSetNVP});}
File 2: src/libs/actions/Session/index.ts
Clean up GPS state when transitioning back to NewDot.
import{resetGPSDraftDetails,setIsTracking}from'@libs/actions/GPSDraftDetails';// ... existing imports ...functionsetupNewDotAfterTransitionFromOldDot(hybridAppSettings: HybridAppSettings,tryNewDot?: TryNewDot){const{hybridApp, ...newDotOnyxValues}=hybridAppSettings;constclearOnyxIfSigningIn=()=>{if(!hybridApp.useNewDotSignInPage){returnPromise.resolve();}Log.info(`[HybridApp] Clearing onyx after transition from OldDot. useNewDotSignInPage set to ${hybridApp.useNewDotSignInPage}`);returnredirectToSignIn();};constresetDidUserLoginDuringSessionIfNeeded=()=>{if(newDotOnyxValues.nvp_tryNewDot===undefined||tryNewDot?.classicRedirect?.dismissed!==true){returnPromise.resolve();}Log.info("[HybridApp] OpenApp hasn't been called yet. Calling `resetDidUserLogInDuringSession`");resetDidUserLogInDuringSession();};returnclearOnyxIfSigningIn().then(()=>{// Stop GPS tracking and clean up GPS tracking state during mode transitionssetIsTracking(false);resetGPSDraftDetails();constcurrentUserEmail=getCurrentUserEmail();if(hybridApp?.delegateAccessData?.oldDotCurrentUserEmail===currentUserEmail){Log.info('[HybridApp] User did not switch account on OldDot side');return;}// ... rest of existing transition logic ...}).then(resetDidUserLoginDuringSessionIfNeeded).then(()=>Promise.all([HybridAppActions.prepareHybridAppAfterTransitionToNewDot({
...hybridApp,closingReactNativeApp: false,}),
...Object.entries(newDotOnyxValues).map(([key,value])=>Onyx.merge(keyasOnyxKey,value??{})),]),).then(()=>{Log.info('[HybridApp] Setup after transition from OldDot finished');isHybridAppSetupFinished=true;returnPromise.resolve();}).catch((error)=>{Log.hmmm('[HybridApp] Initialization of HybridApp has failed. Forcing transition',{error});});}
File 3: src/pages/settings/Troubleshoot/TroubleshootPage.tsx
Show a GPS warning modal before switching to OldDot.
File 4: src/components/ConfirmNavigateExpensifyClassicModal/BaseConfirmNavigateExpensifyClassicModal.tsx
Block navigation and show GPS warning if tracking is active.
This issue has not been updated in over 15 days. @suneox, @GCyganek eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
This issue has not been updated in over 15 days. @GCyganek eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
Activity
[-]Distance - App keep crashing after start GPS and switch to OD[/-][+][$250] Distance - App keep crashing after start GPS and switch to OD[/+]melvin-bot commentedon Jan 27, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022016059787841281593
melvin-bot commentedon Jan 27, 2026
Triggered auto assignment to @bfitzexpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.melvin-bot commentedon Jan 27, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @suneox (
External)yatin-italy commentedon Jan 27, 2026
Proposal
Restate the problem this issue is trying to solve.
When GPS distance tracking is active and the user switches from NewDot to OldDot using Troubleshoot, the app does not handle the transition safely. On Android, the app crashes in a loop after the switch. On iOS, no GPS warning is shown, and after logout the user cannot log back in with the magic code. The system allows a mode switch while GPS tracking is still active.
What is the root cause of that problem?
The root cause is an incorrect assumption in
src/libs/actions/HybridApp/index.tsinside thecloseReactNativeApp()function. The code assumes it is safe to close the React Native app without stopping GPS tracking or clearingGPS_DRAFT_DETAILS. This assumption is wrong because GPS tracking state can still be active. When the app closes withisTracking: truepersisted in Onyx, the background GPS service continues to run. This creates inconsistent state that directly causes crashes on reopen and blocks login flows.What changes do you think we should make in order to solve the problem?
File 1:
src/libs/actions/HybridApp/index.tsAdd GPS cleanup in
closeReactNativeApp()before closing the app.File 2:
src/libs/actions/Session/index.tsClean up GPS state when transitioning back to NewDot.
File 3:
src/pages/settings/Troubleshoot/TroubleshootPage.tsxShow a GPS warning modal before switching to OldDot.
File 4:
src/components/ConfirmNavigateExpensifyClassicModal/BaseConfirmNavigateExpensifyClassicModal.tsxBlock navigation and show GPS warning if tracking is active.
What alternative solutions did you explore? (Optional)
GPS_DRAFT_DETAILSacross transitions was rejected because GPS state must not persist between modes.GCyganek commentedon Jan 27, 2026
Part of GPS feature that I'm responsible for as a Software Mansion engineer, will take care of this
7 remaining items
melvin-bot commentedon Feb 23, 2026
This issue has not been updated in over 15 days. @suneox, @GCyganek eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
melvin-bot commentedon Apr 17, 2026
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.
suneox commentedon May 11, 2026
Could someone please reassign this issue to me as comment? Thanks!
suneox commentedon Jun 3, 2026
@MelvinBot un-assign this issue to me
MelvinBot commentedon Jun 3, 2026
🤖 Done — I've unassigned
suneoxfrom this issue.melvin-bot commentedon Jun 26, 2026
This issue has not been updated in over 15 days. @GCyganek eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
melvin-bot commentedon Aug 24, 2026
@GCyganek, this Monthly task hasn't been acted upon in 6 weeks; closing.
If you disagree, feel encouraged to reopen it -- but pick your least important issue to close instead.