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
[Odometer] [$250] Capture an image in Odometer user is redirected back to Inbox #83526
BugSomething is broken. Auto assigns a BugZero manager.EngineeringExternalAdded to denote the issue can be worked on by a contributorImprovementItem broken or needs improvement.ReviewingHas a PR in reviewWeeklyKSv2
Version Number: 9.3.26-4 Reproducible in staging?: Yes Reproducible in production?: N/A - new feature, doesn't exist in prod If this was caught during regression testing, add the test name, ID and link from BrowserStack:#82432 Email or phone of affected tester (no customers):applausetester+dk10@applause.expensifail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: iPhone 11/iOS26.3 App Component: Money Requests
Action Performed:
Preconditions:
Use Expensifail account
Fresh install app or disable camera permission for Expensify in Settings
Open Native app
Tap on FAB > Track distance
Tap on Odometer tab
Tap on Thumbnail in 'Start reading' or 'End reading'
Tap on 'Continue' button
Tap on 'Don't allow'
On the new prompt, tap on 'Settings'
Enable Camera on the Settings page for Expensify
Navigate back to App, it should stay in Camera page
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Please re-state the problem that we are trying to solve in this issue.
On iOS, when a user is on the Odometer image capture screen and denies camera permission, then navigates to iOS Settings to enable it and returns to the app, capturing a photo redirects them to the Inbox instead of back to the Odometer page.
What is the root cause of that problem?
On iOS, toggling camera permission in Settings can cause the OS to evict the app's nested React Navigation state from memory. When the user returns, the ReportsSplitNavigator route still exists at the root level, but its .state property (containing the nested screen stack) becomes undefined.
The IOURequestStepOdometerImage native component calls Navigation.goBack() with no fallback route after photo capture (index.native.tsx:98-100):
constnavigateBack=()=>{Navigation.goBack();};
With the navigation state lost, goBack() has nowhere meaningful to return to, so React Navigation falls back to the root screen (Inbox).
This exact same bug was already identified and fixed for IOURequestStepScan in #65992. The Scan component detects the lost state and explicitly navigates to a fallback route instead of calling goBack() (IOURequestStepScan/index.native.tsx:231-249):
The IOURequestStepOdometerImage component is missing this guard entirely.
Additionally, the web version of the same component (index.tsx:56-60) correctly passes a fallback route to Navigation.goBack(), while the native version does not.
What changes do you think we should make in order to solve the problem?
In src/pages/iou/request/step/IOURequestStepOdometerImage/index.native.tsx:
Add the navigation-state-loss detection from IOURequestStepScan to the navigateBack / photo capture flow. Before calling Navigation.goBack(), check if ReportsSplitNavigator has lost its nested state. If so, navigate explicitly to the odometer route (using ROUTES.DISTANCE_REQUEST_CREATE_TAB_ODOMETER.getRoute(...)) instead of calling goBack().
Destructure reportID from route params (currently missing at line 66-67, but present in the web version at line 34) so the fallback odometer route can be constructed.
Wrap the useFocusEffect callback in useCallback (line 145) to match the pattern used in IOURequestStepScan (line 200-228), preventing unnecessary teardown/setup cycles of the AppState listener on each render.
What alternative solutions did you explore? (Optional)
Passing odometerRoute to Navigation.goBack() as a fallback (like the web version does): This alone may not be sufficient because goBack() with a backToRoute calls goUp(), which still relies on the navigation state being intact to locate the target screen. The explicit lost-state check from IOURequestStepScan is the more robust approach.
Fixing this at the Navigation.goBack() level globally: While this would prevent similar bugs in other screens, it would be a larger change with higher risk. The per-component fix matches the existing pattern and is safer for a deploy blocker.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.
This issue seems to be present not only on native but also also on web and is also present even without reloading the App (not the exact same issue but the variation of this) and all of that is caused purely by bad back navigation. Current implementation on native works fine before App reload as it simply moves to the previous screen on stack but loses that information when we reload the App hence we land on inbox. In case of web implementation we are always brought back to odometer tab, so when we take photo from confirmation page -> distance -> replace/take photo we are still brought back to odometer tab instead of distance. Because of that this issue has to be merged before we can go ahead with testing the image stitching feature as it makes it impossible to test if images are properly stitched when replaced from confirmation page.
1. It works without refresh
That's because we simply go back on the screen stack to the screen before. This means that we don't have to recognize where we came from. Flows case by case:
flow 1
odometer tab -> thumbnail -> odometerImage screen -> take photo -> we go back to the previous screen on stack so we land on odometer tab
flow 2
fill out values on odometer tab -> confirmation page -> distance -> thumbnail -> odometerImage screen -> take photo -> we go back to the previous screen on stack so we land on distance
2. It doesn't work after refresh
After refresh the screen stack is cleared and we have nowhere to go thus we default back to inbox
1. It works without refresh but only on odometer tab
We always go back to ROUTES.DISTANCE_REQUEST_CREATE_TAB_ODOMETER so when we take a photo from odometer tab we properly navigate back to the odometer tab.
2. It works with refresh but only on odometer tab
We always go back to ROUTES.DISTANCE_REQUEST_CREATE_TAB_ODOMETER so when we go to the odometer image screen from odometer tab and reload then we properly navigate back to the odometer tab.
3. It newer works when we go confirmation -> distance -> take photo
Thats because we always go back to ROUTES.DISTANCE_REQUEST_CREATE_TAB_ODOMETER so it doesn't matter whether we refreshed or not. After we take the photo this is called
Thanks for detailed explanation @jakubkalinski0. So it sounds like we shouldadd loss-detection detection (similar to IOURequestStepScan), And then as you mentioned, expand this to solve for web too?
Thanks for detailed explanation @jakubkalinski0. So it sounds like we shouldadd loss-detection detection (similar to IOURequestStepScan), And then as you mentioned, expand this to solve for web too?
For anybody interested this was discussed and resolved on a private conversation on slack.
BugSomething is broken. Auto assigns a BugZero manager.EngineeringExternalAdded to denote the issue can be worked on by a contributorImprovementItem broken or needs improvement.ReviewingHas a PR in reviewWeeklyKSv2
Activity
melvin-bot commentedon Feb 26, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #82432
melvin-bot commentedon Feb 26, 2026
💬 A slack conversation has been started in #expensify-open-source
melvin-bot commentedon Feb 26, 2026
Triggered auto assignment to @dylanexpensify (
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.github-actions commentedon Feb 26, 2026
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
MelvinBot commentedon Feb 26, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On iOS, when a user is on the Odometer image capture screen and denies camera permission, then navigates to iOS Settings to enable it and returns to the app, capturing a photo redirects them to the Inbox instead of back to the Odometer page.
What is the root cause of that problem?
On iOS, toggling camera permission in Settings can cause the OS to evict the app's nested React Navigation state from memory. When the user returns, the
ReportsSplitNavigatorroute still exists at the root level, but its.stateproperty (containing the nested screen stack) becomesundefined.The
IOURequestStepOdometerImagenative component callsNavigation.goBack()with no fallback route after photo capture (index.native.tsx:98-100):With the navigation state lost,
goBack()has nowhere meaningful to return to, so React Navigation falls back to the root screen (Inbox).This exact same bug was already identified and fixed for
IOURequestStepScanin #65992. The Scan component detects the lost state and explicitly navigates to a fallback route instead of callinggoBack()(IOURequestStepScan/index.native.tsx:231-249):The
IOURequestStepOdometerImagecomponent is missing this guard entirely.Additionally, the web version of the same component (
index.tsx:56-60) correctly passes a fallback route toNavigation.goBack(), while the native version does not.What changes do you think we should make in order to solve the problem?
In
src/pages/iou/request/step/IOURequestStepOdometerImage/index.native.tsx:Add the navigation-state-loss detection from
IOURequestStepScanto thenavigateBack/ photo capture flow. Before callingNavigation.goBack(), check ifReportsSplitNavigatorhas lost its nested state. If so, navigate explicitly to the odometer route (usingROUTES.DISTANCE_REQUEST_CREATE_TAB_ODOMETER.getRoute(...)) instead of callinggoBack().Destructure
reportIDfrom route params (currently missing at line 66-67, but present in the web version at line 34) so the fallback odometer route can be constructed.Wrap the
useFocusEffectcallback inuseCallback(line 145) to match the pattern used inIOURequestStepScan(line 200-228), preventing unnecessary teardown/setup cycles of the AppState listener on each render.What alternative solutions did you explore? (Optional)
odometerRoutetoNavigation.goBack()as a fallback (like the web version does): This alone may not be sufficient becausegoBack()with abackToRoutecallsgoUp(), which still relies on the navigation state being intact to locate the target screen. The explicit lost-state check fromIOURequestStepScanis the more robust approach.Navigation.goBack()level globally: While this would prevent similar bugs in other screens, it would be a larger change with higher risk. The per-component fix matches the existing pattern and is safer for a deploy blocker.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.27 remaining items
jakubkalinski0 commentedon Mar 5, 2026
This issue seems to be present not only on native but also also on web and is also present even without reloading the App (not the exact same issue but the variation of this) and all of that is caused purely by bad back navigation. Current implementation on native works fine before App reload as it simply moves to the previous screen on stack but loses that information when we reload the App hence we land on inbox. In case of web implementation we are always brought back to odometer tab, so when we take photo from
confirmation page -> distance -> replace/take photowe are still brought back to odometer tab instead ofdistance. Because of that this issue has to be merged before we can go ahead with testing the image stitching feature as it makes it impossible to test if images are properly stitched when replaced from confirmation page.App/src/pages/iou/request/step/IOURequestStepOdometerImage/index.tsx
Lines 80 to 84 in 058eee1
App/src/pages/iou/request/step/IOURequestStepOdometerImage/index.native.tsx
Lines 98 to 100 in 058eee1
Julesssss commentedon Mar 5, 2026
To confirm, it occurs in other flows after refreshing. But for this case it occurs without a refresh?
jakubkalinski0 commentedon Mar 5, 2026
@Julesssss Maybe it will be simpler if I break it down case by case to fully explain it.
App/src/pages/iou/request/step/IOURequestStepOdometerImage/index.native.tsx
Lines 98 to 100 in 058eee1
1. It works without refresh
That's because we simply go back on the screen stack to the screen before. This means that we don't have to recognize where we came from. Flows case by case:
2. It doesn't work after refresh
After refresh the screen stack is cleared and we have nowhere to go thus we default back to inbox
App/src/pages/iou/request/step/IOURequestStepOdometerImage/index.tsx
Lines 80 to 84 in 058eee1
1. It works without refresh but only on odometer tab
We always go back to
ROUTES.DISTANCE_REQUEST_CREATE_TAB_ODOMETERso when we take a photo from odometer tab we properly navigate back to the odometer tab.2. It works with refresh but only on odometer tab
We always go back to
ROUTES.DISTANCE_REQUEST_CREATE_TAB_ODOMETERso when we go to the odometer image screen from odometer tab and reload then we properly navigate back to the odometer tab.3. It newer works when we go confirmation -> distance -> take photo
Thats because we always go back to
ROUTES.DISTANCE_REQUEST_CREATE_TAB_ODOMETERso it doesn't matter whether we refreshed or not. After we take the photo this is calledand we land on odometer tab -> thus it's always wrong.
jakubkalinski0 commentedon Mar 5, 2026
I hope that clears it up
Julesssss commentedon Mar 6, 2026
Thanks for detailed explanation @jakubkalinski0. So it sounds like we shouldadd loss-detection detection (similar to IOURequestStepScan), And then as you mentioned, expand this to solve for web too?
Julesssss commentedon Mar 9, 2026
PR merged. #83668
Julesssss commentedon Mar 9, 2026
No payment required, it'll be bundled here.
jakubkalinski0 commentedon Mar 12, 2026
For anybody interested this was discussed and resolved on a private conversation on slack.
Julesssss commentedon Mar 12, 2026
Deployed to prod