Repository navigation
Conversation
|
@MelvinBot please review |
ReviewThe migration looks solid overall. The selection logic moved into 1. The amount field now takes focus every time the confirmation regains focus (desktop)
Suggestion: refocus only on the way back from the participants page. For example, set a ref in 2.
Building the back route with the new 3. Test gap The new tests cover auto-open and the frozen participant list. Nothing covers Checked and fine
|
|
…cipant-picker # Conflicts: # src/components/MoneyRequestConfirmationList/sections/AmountField.tsx
|
Thanks. I checked the new commit, and all three points are resolved. I have no further comments.
The only failing check is |
|
@parasharrajat 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] |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c770606f2a
ℹ️ 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".
| const autoOpenedForTransactionIDRef = useRef<string | undefined>(undefined); | ||
| useEffect(() => { | ||
| // The confirmation is also a tab of `IOURequestStartPage`, so only the focused tab opens it. | ||
| if (!shouldAutoOpenParticipantPicker || !isFocused || autoOpenedForTransactionIDRef.current === activeTransactionID) { | ||
| return; | ||
| } | ||
| // P2P chats don't support negative amounts. When a negative amount was entered before a participant | ||
| // was selected (e.g. "Submit it to someone" from a self DM), assigning it to a P2P participant would | ||
| // fail at submit, so keep the expense on the self DM (its default) instead of assigning the P2P | ||
| // participant, stopping the user at selection rather than at submit. This only applies while the | ||
| // expense is still on the self DM — a negative expense already bound to a policy expense chat (e.g. | ||
| // global create auto-assigned the default workspace) must stay on that workspace rather than being | ||
| // silently converted into a personal track expense. | ||
| const isTransactionOnPolicyExpenseChat = transaction?.participants?.some((participant) => participant?.isPolicyExpenseChat); | ||
| const shouldKeepOnSelfDM = !!selectedParticipant?.isSelfDM || ((transaction?.amount ?? 0) < 0 && !isTransactionOnPolicyExpenseChat && isParticipantP2P(selectedParticipant)); | ||
| if (shouldKeepOnSelfDM) { | ||
| setMoneyRequestParticipantsFromReport(activeTransactionID, selfDMReport, currentUserPersonalDetails.accountID); | ||
| setTransactionReport(activeTransactionID, {reportID: CONST.REPORT.UNREPORTED_REPORT_ID}, true); | ||
|
|
||
| // The rate the expense picked up from a workspace does not exist outside it, so leaving it in place | ||
| // makes the Rate field read "Pending..." and the amount go blank once the expense is back on the self | ||
| // DM. Re-resolve the rate the self DM itself uses, the same way starting a track distance expense does. | ||
| if (isDistanceRequest) { | ||
| const selfDMRateID = DistanceRequestUtils.getCustomUnitRateID({ | ||
| reportID: selfDMReport?.reportID, | ||
| isPolicyExpenseChat: false, | ||
| isTrackDistanceExpense: true, | ||
| policy: policyForMovingExpenses, | ||
| lastSelectedDistanceRates, | ||
| expenseDate: transaction?.created, | ||
| }); | ||
| setCustomUnitRateID( | ||
| activeTransactionID, | ||
| selfDMRateID, | ||
| transaction, | ||
| policyForMovingExpenses, | ||
| false, | ||
| policyForMovingExpenses?.outputCurrency ?? personalPolicy?.outputCurrency, | ||
| ); | ||
| } | ||
|
|
||
| if (iouType !== CONST.IOU.TYPE.TRACK) { | ||
| navigation.setParams({iouType: CONST.IOU.TYPE.TRACK}); | ||
| } | ||
| } else { | ||
| if (iouType === CONST.IOU.TYPE.SUBMIT || iouType === CONST.IOU.TYPE.TRACK) { | ||
| navigation.setParams({iouType: CONST.IOU.TYPE.CREATE}); | ||
| } | ||
| setMoneyRequestParticipants(activeTransactionID, participantsList); | ||
| const firstParticipant = participantsList.at(0); | ||
| if (iouType !== CONST.IOU.TYPE.SPLIT && firstParticipant) { | ||
| const isPolicyExpenseChatParticipant = !!firstParticipant.isPolicyExpenseChat; | ||
|
|
||
| // A brand-new recipient picked by email has no chat yet (no reportID). Reusing the route's `reportID` | ||
| // (which points at the flow's origin report - e.g. the default workspace chat this distance flow was | ||
| // seeded with) leaves the expense bound to that workspace, so the backend rejects it with | ||
| // "There is a previously existing chat between these users." Generate a fresh optimistic reportID for | ||
| // P2P recipients, mirroring the legacy participants-step flow (useParticipantSubmission). | ||
| const participantReportID = firstParticipant.reportID || (isPolicyExpenseChatParticipant ? reportID : generateReportID()); | ||
| setTransactionReport(activeTransactionID, {reportID: participantReportID}, true); | ||
|
|
||
| // When switching from the auto-assigned default workspace to a P2P recipient we must also undo the | ||
| // workspace-specific defaults the distance step applied: reset the mileage rate to the P2P rate and | ||
| // clear the workspace's default category (and the category-derived tax). Otherwise the confirmation | ||
| // keeps the workspace "Default Rate"/category and the expense stays bound to that workspace. This | ||
| // mirrors what the legacy addParticipant/goToNextStep path does when a P2P recipient is selected. | ||
| if (!isPolicyExpenseChatParticipant) { | ||
| if (isDistanceRequest) { | ||
| const p2pRateID = DistanceRequestUtils.getCustomUnitRateID({ | ||
| reportID: firstParticipant.reportID, | ||
| isPolicyExpenseChat: false, | ||
| policy: undefined, | ||
| lastSelectedDistanceRates, | ||
| expenseDate: transaction?.created, | ||
| }); | ||
| setCustomUnitRateID(activeTransactionID, p2pRateID, transaction, undefined, false, personalPolicy?.outputCurrency); | ||
| } | ||
| setMoneyRequestCategory(activeTransactionID, '', undefined, getCurrencyDecimals); | ||
| setMoneyRequestTag(activeTransactionID, ''); | ||
| } else { | ||
| const workspacePolicy = selectedPolicy; | ||
| if (isDistanceRequest) { | ||
| const currentRateID = transaction?.comment?.customUnit?.customUnitRateID; | ||
| const isCurrentRateFromWorkspace = !!currentRateID && !!DistanceRequestUtils.getMileageRates(workspacePolicy)[currentRateID]; | ||
| if (!isCurrentRateFromWorkspace) { | ||
| const workspaceRateID = DistanceRequestUtils.getCustomUnitRateID({ | ||
| reportID: participantReportID, | ||
| isPolicyExpenseChat: true, | ||
| policy: workspacePolicy, | ||
| lastSelectedDistanceRates, | ||
| expenseDate: transaction?.created, | ||
| }); | ||
| setCustomUnitRateID(activeTransactionID, workspaceRateID, transaction, workspacePolicy, false, workspacePolicy?.outputCurrency); | ||
| } | ||
| } | ||
|
|
||
| // Switching to a different workspace: the previous workspace's category and tag no longer apply, | ||
| // so reset them to the destination workspace's defaults. This mirrors the legacy participants-step | ||
| // flow (useParticipantSubmission.goToNextStep), which resets both on every selection and passes no | ||
| // policy so the previous workspace's category-derived tax is cleared along with the category. | ||
| if (firstParticipant.policyID && firstParticipant.policyID !== policyID) { | ||
| const defaultCategory = isDistanceRequest ? (getDistanceRateCustomUnit(workspacePolicy)?.defaultCategory ?? '') : ''; | ||
| setMoneyRequestCategory(activeTransactionID, defaultCategory, undefined, getCurrencyDecimals); | ||
| setMoneyRequestTag(activeTransactionID, ''); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| if (participantsList.length > 0) { | ||
| closeParticipantPicker(); | ||
| } | ||
| }; | ||
| autoOpenedForTransactionIDRef.current = activeTransactionID; |
There was a problem hiding this comment.
Preserve picker dismissal across route restoration
When this routed picker is restored directly while a manual draft still has no recipient (for example, after refreshing the browser on the expense-participants URL), the confirmation either mounts behind it without running line 74 or mounts only after Back, so this component-local ref is still undefined. Pressing Back then focuses the confirmation with shouldAutoOpenParticipantPicker still true and immediately navigates to the picker again, meaning repeated Back cannot dismiss it without selecting a recipient; the dismissal/opened state needs to survive route restoration or be marked by the participants route before returning.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
This is very unlikely to happen in real life. It needs a web refresh while the picker is open, on a draft with no recipient and no default one, so I'll leave as is for now.
|
@parasharrajat kind bump |
|
THanks for the ping. Will check soon. I was on leave last week. |
# Conflicts: # src/pages/iou/request/step/IOURequestStepConfirmation/index.tsx # tests/unit/components/MoneyRequestConfirmationList/AmountField.test.tsx
|
@parasharrajat can you review and test this pr please? thanks |
There was a problem hiding this comment.
Reviewer Checklist
- I have verified the author checklist is complete (all boxes are checked off).
- I verified the correct issue is linked in the
### Fixed Issuessection above - I verified testing steps are clear and they cover the changes made in this PR
- I verified the steps for local testing are in the
Testssection - I verified the steps for Staging and/or Production testing are in the
QA stepssection - I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
- I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
- I verified the steps for local testing are in the
- I checked that screenshots or videos are included for tests on all platforms
- I included screenshots or videos for tests on all platforms
- I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
- I verified tests pass on all platforms & I tested again on:
- Android: HybridApp
- Android: mWeb Chrome
- iOS: HybridApp
- iOS: mWeb Safari
- MacOS: Chrome / Safari
- If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
- I verified proper code patterns were followed (see Reviewing the code)
- I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e.
toggleReportand notonIconClick). - I verified that comments were added to code that is not self explanatory
- I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
- I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
- I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e.
- If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- I verified that this PR follows the guidelines as stated in the Review Guidelines
- I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like
Avatar, I verified the components usingAvatarhave been tested & I retested again) - If a new component is created I verified that:
- A similar component doesn't exist in the codebase
- All props are defined accurately and each prop has a
/** comment above it */ - The file is named correctly
- The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
- The only data being stored in the state is data necessary for rendering and nothing else
- For Class Components, any internal methods passed to components event handlers are bound to
thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor) - Any internal methods bound to
thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick) - All JSX used for rendering exists in the render method
- The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
- If any new file was added I verified that:
- The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
- If a new CSS style is added I verified that:
- A similar style doesn't already exist
- The style can't be created with an existing StyleUtils function (i.e.
StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
- If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
- If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like
Avataris modified, I verified thatAvataris working as expected in all cases) - If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
- If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
- If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
- I verified that all the inputs inside a form are aligned with each other.
- I added
Designlabel and/or tagged@Expensify/designso the design team can review the changes.
- For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
- If the
mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps. - I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.
Screenshots
🔲 iOS / native
02.11.2026_19.18.26_REC.mp4
🔲 iOS / Safari
02.11.2026_19.19.52_REC.mp4
🔲 MacOS / Chrome
02.11.2026_18.58.39_REC.mp4
🔲 Android / native
02.11.2026_19.11.53_REC.mp4
🎀 👀 🎀 C+ reviewed
|
Looks good. |
# Conflicts: # src/pages/iou/request/step/IOURequestStepConfirmation/useParticipantPickerState.ts
mountiny
left a comment
There was a problem hiding this comment.
(Vit's agent) Requesting changes for one merge blocker. The rest looks good, and the getReportOrDraftReport fixes in the last merge are correct.
Blocker: the branch conflicts with main again and won't typecheck after the merge
main landed Stop predicting a category's tax on the client. It removed the getCurrencyDecimals argument from setMoneyRequestCategory, and the 4th parameter is now isMovingFromTrackExpense?: boolean. I merged main into this branch locally and ran tsc. These are the only errors in this PR's files:
src/hooks/useConfirmationParticipantSelection.ts(154,83): error TS2345: Argument of type '(currencyCode: string | undefined) => number' is not assignable to parameter of type 'boolean | undefined'.
src/hooks/useConfirmationParticipantSelection.ts(177,100): error TS2345: Argument of type '(currencyCode: string | undefined) => number' is not assignable to parameter of type 'boolean | undefined'.
To fix:
- Merge
main. InuseParticipantPickerState.ts, keep this PR's side. The blockmainedited is the one this PR deletes. - Remove
getCurrencyDecimalsfrom the twosetMoneyRequestCategorycalls inuseConfirmationParticipantSelection.ts(lines 154 and 177). - Remove the
useCurrencyListActionsimport and thegetCurrencyDecimalsline (lines 20 and 62), so lint doesn't flag them as unused.
main made the same change in useParticipantSubmission, so dropping the argument is all that's needed.
Not blocking: one inline note on DynamicIOURequestStepParticipants.tsx about which workspace a new pick is compared against.
| }); | ||
| setCustomUnitRateID(transactionIDToUpdate, p2pRateID, transactionToUpdate, undefined, false, personalPolicy?.outputCurrency); | ||
| } | ||
| setMoneyRequestCategory(transactionIDToUpdate, '', undefined, getCurrencyDecimals); |
There was a problem hiding this comment.
(Vit's agent) After merging main, this call and the one on line 177 fail typecheck. main removed getCurrencyDecimals from setMoneyRequestCategory, and the 4th parameter is now isMovingFromTrackExpense?: boolean. Drop the last argument in both calls:
setMoneyRequestCategory(transactionIDToUpdate, '', undefined);Then remove useCurrencyListActions (line 20) and getCurrencyDecimals (line 62), since nothing else in this hook uses them.
| transaction: initialTransaction, | ||
| iouType, | ||
| reportID, | ||
| policyID: getSelectedWorkspacePolicyID(initialTransaction, action) ?? getReportOrDraftReport({reportID})?.policyID, |
There was a problem hiding this comment.
(Vit's agent) Not blocking. This policyID decides whether a pick clears the category and tag (firstParticipant.policyID !== policyID in useConfirmationParticipantSelection). It no longer matches the value the confirmation passed to the old picker.
The confirmation passed policy?.id from usePolicyForTransaction. For an unreported or self DM expense, that is policyForMovingExpenses. Here the fallback is the route report's policyID. In global create that report is usually optimistic, so the value is undefined or the self DM's _FAKE_ placeholder.
- Create a manual expense and pick "You" in "To".
- Pick a category. The list comes from the workspace in
policyForMovingExpenses(call it W). - Change "To" to W's workspace chat.
Expected: the category stays, as it did with the old picker.
Actual: the category is cleared.
I traced this in the code but did not reproduce it on a device. One way to fix it: resolve the policy here the same way the confirmation does, with usePolicyForTransaction, and pass its id.
There was a problem hiding this comment.
|
conflicts |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
all addressed @mountiny |
|
🚧 mountiny 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/mountiny in version: 9.5.33-0 🚀
|
|
No FullStory changes needed. This PR refactors existing recipient selection to reuse the existing routed participants screen, preserving tracking identifiers and masking, with screen changes already tracked automatically. |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.5.33-1 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
The confirmation page's "To" row, and the auto-open for a manual expense with no recipient, now navigate to the existing routed participants page (
DynamicIOURequestStepParticipants, in a newisFromConfirmationmode) instead of opening the inlineParticipantPickermodal, which is deleted along with its iOS overlay, referral and focus workarounds.Fixed Issues
$ #104753
PROPOSAL:
Tests
Scenario 1 - Change recipient from the "To" row
Scenario 2 - Auto open
Offline tests
Same as tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)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
Android: Native
screen-recording-emulator-5554-1792674994226.mp4
Android: mWeb Chrome
screen-recording-emulator-5554-1792676994552.mp4
iOS: Native
screen-recording-6AB7550A-7051-41A2-BA46-CB5AA71941B5-1792677501634.mp4
iOS: mWeb Safari
screen-recording-6AB7550A-7051-41A2-BA46-CB5AA71941B5-1792677723148.mp4
MacOS: Chrome / Safari
participant-picker-migration.mp4