Skip to content

Fix: open referral RHP on first click in new manual expense flow#94546

Open
MelvinBot wants to merge 2 commits into
mainfrom
claude-fixReferralRHPManualExpense
Open

Fix: open referral RHP on first click in new manual expense flow#94546
MelvinBot wants to merge 2 commits into
mainfrom
claude-fixReferralRHPManualExpense

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

In the new manual expense flow (isNewManualExpenseFlowEnabled beta), the To participant selector is no longer a navigation screen — it's a JS RIGHT_DOCKED Modal (ParticipantPicker) whose visibility is driven by local React state in IOURequestStepConfirmation, layered on top of the confirmation RHP.

When the referral banner at the bottom of the picker was pressed, ReferralProgramCTA called Navigation.navigate(...) which swapped the underlying RHP to the referral panel, but nothing dismissed the still-mounted picker overlay. So the picker covered the freshly-presented referral RHP and the user saw "nothing happened." Tapping back closed the picker overlay, revealing the referral RHP that had been underneath the whole time — matching the reported "only opens after returning from participant list."

By contrast, NewChatPage uses the same ReferralProgramCTA and works because there the participant selector is a top-level RHP screen, so navigating to referral replaces it on the same modal stack with nothing layered on top.

Note: the offending PR (#94134, which made the new flow the default) was already reverted. This is the forward fix so the bug is gone when the new manual expense flow is re-enabled.

Fix: give ReferralProgramCTA an optional onBeforeNavigate callback that fires right before it navigates, and thread the picker's existing closeParticipantPicker/onClose handler down to it (ParticipantPickerMoneyRequestParticipantsSelectorParticipantSearchResultsParticipantSelectorFooterReferralProgramCTA). Pressing the banner now dismisses the picker overlay first, so the referral RHP is revealed immediately. The prop is optional, so NewChatPage and every other ReferralProgramCTA caller are unchanged.

A navigation-listener / focus-based auto-dismiss was considered but rejected: the referral route is a dynamic route appended to the current route's path (an overlay on the same screen), so the confirmation screen does not blur and useIsFocused would not flip. The explicit close-before-navigate approach is deterministic.

Fixed Issues

$ #94234
PROPOSAL: #94234 (comment)

Tests

// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review".
// Please describe what tests you performed that validate your changes worked.

  1. Enable the new manual expense flow.
  2. Open FAB > Create expense > Manual.
  3. Click the To field to open the participant selector.
  4. Click the referral banner at the bottom.
  5. Verify the referral RHP opens immediately (on the first click), without needing to back out of the participant list first.
  • Verify that no errors appear in the JS console

Offline tests

Same as tests.

QA Steps

// TODO: The human co-author must fill out the QA tests you ran before marking this PR as "ready for review".

  1. Enable the new manual expense flow.
  2. Open FAB > Create expense > Manual.
  3. Click the To field to open the participant selector.
  4. Click the referral banner at the bottom.
  5. Verify the referral RHP opens immediately on the first click.
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover 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 tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (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. toggleReport and not onIconClick)
    • 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)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • 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 new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • 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 Avatar is modified, I verified that Avatar is 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 Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

Co-authored-by: thelullabyy <thelullabyy@users.noreply.github.com>
@thelullabyy

Copy link
Copy Markdown
Contributor

@MelvinBot Please merge main. After that replace all [ ] characters in PR description by [x]. Finally, open this PR for review

…ManualExpense

Co-authored-by: thelullabyy <thelullabyy@users.noreply.github.com>
@MelvinBot MelvinBot marked this pull request as ready for review June 26, 2026 06:21
@MelvinBot MelvinBot requested a review from a team as a code owner June 26, 2026 06:21
@melvin-bot melvin-bot Bot requested review from thelullabyy and removed request for a team June 26, 2026 06:21
@melvin-bot

melvin-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

@thelullabyy 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]

@melvin-bot melvin-bot Bot requested review from flaviadefaria and removed request for a team June 26, 2026 06:21
@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Done:

  1. ✅ Merged main into claude-fixReferralRHPManualExpense (clean merge, no conflicts) and pushed.
  2. ✅ Replaced every [ ] with [x] in the PR description (43 checkboxes now checked, 0 remaining unchecked).
  3. ✅ Marked the PR as Ready for review (out of draft).

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 I looked into the failing checks and there's nothing to fix — no functional check is failing.

Current status: 31 passing, 0 failing, 4 skipped, and 2 still running (the branch-perf-tests / baseline-perf-tests Reassure benchmarks, which finish slowly and aren't affected by this change).

The red ❌ you likely saw was a transient PR Author Checklist run that has already been superseded by a passing run — that check just needs the human checklist filled in and isn't something I act on.

All the substantive CI is green: TypeScript, all 8 Jest jobs, ESLint, Prettier, Bun tests, Storybook, the builds, Knip, and spellcheck. No code changes were needed, so I haven't pushed anything. If a check flips to a real failure after the perf benchmarks finish, re-ping me and I'll dig in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants