[NO QA] Prevent error on country selection screen when opened without a selected country#94632
Conversation
|
@eVoloshchak Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@flaviadefaria @eVoloshchak please ignore the ping |
|
@mananjadhav Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@mananjadhav This PR doesn't need C+ review. Can you rubber-stamp approve this so that it gets auto-assigned to an internal engineer? |
|
@blimpich Done. |
|
@NicolasBonet Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Reviewer Checklist
|
|
🚧 NicolasBonet has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/NicolasBonet in version: 9.4.26-0 🚀
|
|
🤖 No help site changes required. This PR is a defensive code fix, not a behavior or feature change. It adds optional chaining ( There's no user-facing change to document:
Nothing under |
|
🚀 Deployed to production by https://github.com/grgia in version: 9.4.27-2 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Opening the country selection screen could throw an error and leave the country list unrendered when the screen was reached without a country already selected — for example when the app restored navigation directly onto that screen, or it was opened via a direct link. The screen now treats missing navigation params as "no country selected" and renders the full list normally.
Added a unit test covering the missing-params case.
Evidence: observed in production via Sentry — APP-G8Y,
TypeError: Cannot read property 'country' of undefinedwith culpritDynamicCountrySelectionPage(iOS,release: new.expensify@9.4.18-2).Fixed Issues
$ #94629
PROPOSAL:
Tests
Regression is covered by an added unit test. The crash condition (the screen mounting with no navigation params) is not deterministically reproducible by hand, so there are no manual repro steps.
Offline tests
N/A — no network-dependent behavior is affected.
QA Steps
N/A —
[No QA]. No manual reproduction exists for the crash condition; the fix is covered by a unit test.PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, 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.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
No UI change — defensive guard against a crash; nothing to screenshot.
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
– written by Claude on Ben's behalf