[CP Staging & Prod] Fix ReferenceError in getCurrentPosition() - web API reference on mobile#79222
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
🚧 @mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
| let code = GeolocationErrorCode.POSITION_UNAVAILABLE; | ||
|
|
||
| if (caughtError instanceof GeolocationPositionError) { | ||
| if (Platform.OS === 'web' && caughtError instanceof GeolocationPositionError) { |
There was a problem hiding this comment.
As the file is small, can we separate this into index.ts, index.native.ts?
There was a problem hiding this comment.
Yes we just chatted about it but in sake of fixing this asap we allow it for this PR
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid1.movandroid2.movAndroid: mWeb Chromemchrome.moviOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
…tCurrentPosition-web-api-reference-on-mobile [CP Staging & Prod] Fix ReferenceError in getCurrentPosition() - web API reference on mobile (cherry picked from commit b97ba94) (cherry-picked to staging by AndrewGable)
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Cherry-picked to staging by https://github.com/AndrewGable in version: 9.2.97-2 🚀
|
…tCurrentPosition-web-api-reference-on-mobile [CP Staging & Prod] Fix ReferenceError in getCurrentPosition() - web API reference on mobile (cherry picked from commit b97ba94) (cherry-picked to production by AndrewGable)
|
🚀 Deployed to production by https://github.com/arosiclair in version: 9.2.98-0 🚀
|
|
🚀 Cherry-picked to staging by https://github.com/AndrewGable in version: 9.2.99-0 🚀
|
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.2.99-8 🚀
|
|
🚀 Cherry-picked to staging by https://github.com/AndrewGable in version: 9.3.0-0 🚀
|
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.3.0-8 🚀
|
Explanation of Change
Fixes
ReferenceErrorcaused by checking if caught error is instance ofGeolocationPositionErrorwhich is a web API can't shouldn't be referenced on mobile.This was brought up on Slack with this sentry link: https://expensify.sentry.io/issues/7112671849/?environment=production&project=4510228107427840&query=is%3Aunresolved%20user.email%3A%EF%80%8DContains%EF%80%8Dflorent%40expensify.com
Fixed Issues
$ #79230
PROPOSAL: N/A
Tests
It's not easy to trigger an error when the
getCurrentPosition()is called without code changes.For mobile, change the code to throw a random error like this:
Go to the Map distance expense screen and (FAB > Track distance) try to load your current location for the Start/Stop endpoint. Verify that there is no spinner spinning forever and that there is an error displayed to the user.
Web:
Comment out these first lines of
getCurrentPosition()function:Disable location access and go to the Map distance expense screen and (FAB > Track distance) try to load your current location for the Start/Stop endpoint. Verify that there is no spinner spinning forever and that there is an error displayed to the user.
Can be also tested using Scan receipt flow with a receipt that has erased currency:
Offline tests
Same as tests
QA Steps
make sure this works on mobile:
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Screen.Recording.2026-01-09.at.18.38.49.mov
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-01-09.at.18.37.55.mov