Skip to content

[Performance] Pre-mount new expense destinations behind confirmation RHP - #97874

Merged
mountiny merged 50 commits into
Expensify:mainfrom
software-mansion-labs:korytko/rhp-navigation-improvements
Sep 9, 2026
Merged

mountiny merged 50 commits into
Expensify:mainfrom
software-mansion-labs:korytko/rhp-navigation-improvements

Conversation

@JakubKorytko

@JakubKorytko JakubKorytko commented Aug 5, 2026 •

Copy link
Copy Markdown
Member

Explanation of Change

Improves confirmation RHP destination pre-mounting for new 1:1 chats and employer workspaces. It reuses stable optimistic report IDs, safely promotes draft reports for rendering, suppresses premature report fetching, cleans interrupted promotions, and inserts a neutral buffer route under the RHP so a native swipe-dismiss reveals it instead of flashing the pre-mounted destination.

Fixed Issues

$ #98139
PROPOSAL: N/A

Tests

  1. On a narrow layout, use an account that has no existing chat with another user, click the global +, select Create expense, enter an amount, and choose that user as the recipient.
  2. On the confirmation page, click Create expense.
  3. Verify that the new recipient chat opens with the created expense without flashing the previous page. A brief loading state is fine; getting stuck on it is not.

  1. On a narrow layout, use an account with the SUBMIT_2026 beta enabled and no existing workspace, open a tracked expense in the self chat, and click Submit to my employer.
  2. Complete the expense details and click Create expense on the confirmation page.
  3. Verify that the newly created workspace expense chat opens immediately with the expense. A brief loading state is fine; getting stuck on it is not.

  1. On iOS native, use the QAB Create expense entry point for 1:1 expense - this lands directly on a single-screen RHP (no participants/amount steps stacked underneath), so a swipe from the screen edge dismisses the whole RHP instead of popping one inner step back.
  2. Before submitting, swipe away the RHP from the screen edge.
  3. Verify the swipe dismisses back to where you started, without ever flashing the pre-mounted destination underneath.
  4. Repeat via the global + flow and swipe on the confirmation screen instead: verify it just pops back to the amount step (RHP stays open).
  5. Use the visible back button to leave either flow instead of swiping, then open it again and submit the expense.
  6. Verify that backing out does not leave a speculative report visible, and the later submission opens the correct destination.

Offline tests

  1. On a narrow layout, start the new-recipient scenario from the Tests section and reach the confirmation page while online.
  2. Disable the network connection, then click Create expense.
  3. Verify that the new chat opens with the optimistic expense without flashing the previous page or remaining on a loading screen, and that the expense syncs after reconnecting.

QA Steps

Same as tests

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 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 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.mov
Android: mWeb Chrome
iOS: Native
iOS.mov
iOS: mWeb Safari
MacOS: Chrome / Safari

@JakubKorytko

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 946460a7b6

ℹ️ 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".

@codecov

codecov Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/CONST/runtimeConfigured.ts 100.00% <ø> (ø)
src/CONST/runtimeDefaults.ts 100.00% <ø> (ø)
src/ONYXKEYS.ts 100.00% <ø> (ø)
src/ROUTES.ts 27.82% <100.00%> (+0.12%) ⬆️
src/SCREENS.ts 100.00% <ø> (ø)
src/hooks/usePreMountDestination/index.ts 94.73% <ø> (ø)
src/libs/ExportOnyxState/common.ts 80.95% <ø> (ø)
src/libs/IOUUtils.ts 81.04% <100.00%> (+0.28%) ⬆️
src/libs/Navigation/AppNavigator/AuthScreens.tsx 83.67% <100.00%> (+0.34%) ⬆️
...ateRootStackNavigator/GetStateForActionHandlers.ts 79.10% <100.00%> (+4.64%) ⬆️
... and 14 more
... and 35 files with indirect coverage changes

@JakubKorytko

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: d77efce009

ℹ️ 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".

@JakubKorytko
JakubKorytko force-pushed the korytko/rhp-navigation-improvements branch from d77efce to c5ccc51 Compare August 5, 2026 15:47
@JakubKorytko
JakubKorytko force-pushed the korytko/rhp-navigation-improvements branch from 17fd0cb to ac63040 Compare August 10, 2026 13:18
@JakubKorytko

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac630400e6

ℹ️ 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".

@JakubKorytko

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 71d480f11f

ℹ️ 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".

@JakubKorytko JakubKorytko changed the title [WIP] [Performance] Pre-mount new expense destinations behind confirmation RHP [Performance] Pre-mount new expense destinations behind confirmation RHP Aug 10, 2026
@JakubKorytko
JakubKorytko marked this pull request as ready for review August 10, 2026 14:11
@JakubKorytko
JakubKorytko requested review from a team as code owners August 10, 2026 14:11
@melvin-bot
melvin-bot Bot requested review from gijoe0295 and removed request for a team August 10, 2026 14:11
@JakubKorytko

Copy link
Copy Markdown
Member Author

Valid! Fixed, also re-tested whole PR and nothing regressed.

Fixed.mov

@marufsharifi

Copy link
Copy Markdown
Contributor

@JakubKorytko, checking again. thanks.

@mountiny mountiny left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for retesting @marufsharifi and addressing that @JakubKorytko ❤️

@mountiny
mountiny merged commit 94d92d4 into Expensify:main Sep 9, 2026
46 of 68 checks passed
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

OSBotify commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify OSBotify mentioned this pull request Sep 9, 2026
83 tasks done
@OSBotify

OSBotify commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.75-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

MelvinBot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

🤖 No help site changes are required for this PR — so I did not create a docs draft PR.

Why: this change is entirely internal to navigation and rendering. It pre-mounts the destination screen behind the confirmation RHP, reuses optimistic report IDs, suppresses premature openReport calls, and inserts a neutral buffer route so a native swipe-dismiss doesn't flash the pre-mounted destination. The user-visible result is the absence of a flash and a shorter loading state — not a new or changed feature.

Nothing in the diff touches what App/docs/articles documents:

  • No copy changes. No src/languages/*.ts files are modified, so no button, tab, or setting label changed.
  • No flow changes. The steps in the test plan (global + → Create expense → amount → recipient → Create expense, and More → Submit to my employer) are the same steps that exist today.
  • No new settings or entry points. The only new route (PreMountBufferPage) is an invisible buffer screen users never land on.
  • The relevant article is still accurate. docs/articles/new-expensify/reports-and-expenses/Track-Expenses.md:83 already describes Submit to my employer creating a workspace automatically when you don't have one, which this PR preserves.

The documentation that does need updating is developer-facing, and this PR already updates it: contributingGuides/NAVIGATION.md and the perf-18-use-pre-mount-destination coding-standards rule.

@JakubKorytko, since no help site PR was needed there's nothing to review on that side. If you think a user-facing behavior here should be documented that I've missed, reply with @MelvinBot and the detail, and I'll create the docs draft PR.


view run · view recording

@nlemma

nlemma commented Sep 9, 2026

Copy link
Copy Markdown

Deploy Blocker #100767 was identified to be related to this PR.

@JakubKorytko

Copy link
Copy Markdown
Member Author

Will take a look at DB tomorrow (in about 9-10 hours) as a top priority

@mitarachim

Copy link
Copy Markdown

Deploy Blocker #100777 was identified to be related to this PR.

@jponikarchuk

Copy link
Copy Markdown

Deploy Blocker #100785 was identified to be related to this PR.

@jponikarchuk

Copy link
Copy Markdown

This PR failing because of the issue #100785
This issue is reproducible in: iOS app

@JakubKorytko

Copy link
Copy Markdown
Member Author

Working on the DB's above!

@JakubKorytko

JakubKorytko commented Sep 10, 2026 •

Copy link
Copy Markdown
Member Author

#100826 opened, fixes #100785 & #100767. The rest mentioned here are not caused by this PR

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/mountiny in version: 9.4.75-3 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 failure ❌
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/mountiny in version: 9.4.75-3 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 failure ❌
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

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.