Migrate workspace address payload to discrete fields#84380
Migrate workspace address payload to discrete fields#84380c3024 wants to merge 11 commits intoExpensify:mainfrom
Conversation
Align SetPolicyAddress requests with discrete backend params and preserve compatibility with legacy newline-formatted addresses while rendering and formatting workspace data.
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
src/pages/workspace/duplicate/WorkspaceDuplicateSelectFeaturesForm.tsx
Outdated
Show resolved
Hide resolved
Validate that workspace address updates send flat SetPolicyAddress params and that address formatting prefers addressStreet2 while preserving newline fallback for legacy payloads.
|
@nyomanjyotisa 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] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f36e5b158c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Split legacy newline-formatted addressStreet before preferring addressStreet2 so the form prefill keeps the correct second line when both formats are present.
Reuse a shared workspace address formatter and street parser across workspace views and policy change messages to remove duplicated legacy/new address handling and keep behavior consistent.
|
@codex, review |
|
👋 @c3024 Should I help review this? But it seems Melvin pulled two C+ here. |
Deduplicate address formatting by keeping formatAddressToString in ReportActionsUtils and reusing it in workspace pages, while retaining only street-line parsing in WorkspacesSettingsUtils.
Replace duplicated inline address shapes with CompanyAddress-based derived types in report action and workspace settings utilities to keep address typing in sync with the canonical policy model.
Use truthy checks for address line 2 fallback so empty explicit values still preserve legacy newline second lines, and add regression tests for both helper and report message paths.
Inline the temporary street line variable and preserve prior city/state/zip handling while keeping the empty explicit line-2 fallback behavior.
Export WorkspaceAddress from WorkspacesSettingsUtils and reuse it in ReportActionsUtils to keep the workspace address shape defined in one place.
|
@eh2077 , yes, please. Don't know why PullerBear did that. I will remove the request for Nyoman's review. |
|
@codex review. |
Call getWorkspaceAddressStreetLines from formatAddressToString so newline parsing and addressStreet2 fallback logic stay centralized in one helper.
Explanation of Change
This PR completes the App-side migration for workspace address updates so
SetPolicyAddresssends discrete fields instead of legacydata[...]keys.What changed
UpdatePolicyAddressParamsto use flat fields:addressStreetaddressStreet2citycountrystatezipCodeupdateAddress()action payload mapping to send flat fields.addressStreet2?: stringtoCompanyAddress.addressLine1 + "\n" + addressLine2when submitting workspace/travel address forms.addressStreet:addressStreet2when present.addressStreetby newline.Files updated
src/libs/API/parameters/UpdatePolicyAddressParams.tssrc/libs/actions/Policy/Policy.tssrc/types/onyx/Policy.tssrc/pages/workspace/WorkspaceOverviewAddressPage.tsxsrc/pages/Travel/WorkspaceAddressForTravelPage.tsxsrc/pages/workspace/WorkspaceOverviewPage.tsxsrc/pages/workspace/duplicate/WorkspaceDuplicateSelectFeaturesForm.tsxsrc/libs/ReportActionsUtils.tsFixed Issues
$ #84378
https://github.com/Expensify/Expensify/issues/394853
PROPOSAL: N/A
Tests
Go to
Workspace > Overview > Address.Enter:
123 Main StSuite 200Save and verify:
Open network request for
SetPolicyAddressand verify payload uses flat keys (addressStreet,addressStreet2,city,country,state,zipCode) and notdata[...].Verify that no errors appear in the JS console
Screen.Recording.2026-03-06.at.3.38.25.PM.mov
Screen.Recording.2026-03-06.at.3.37.10.PM.mov
Offline tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-03-06.at.3.38.25.PM.mov
Screen.Recording.2026-03-06.at.3.37.10.PM.mov