Skip to content

refactor: Pass the split write barrier in and require submission flags - #103695

Merged
Gonals merged 7 commits into
Expensify:mainfrom
TaduJR:refactor-code-to-keep-navigation-handling-in-the-UI-components
Nov 3, 2026
Merged

Gonals merged 7 commits into
Expensify:mainfrom
TaduJR:refactor-code-to-keep-navigation-handling-in-the-UI-components

Conversation

@TaduJR

@TaduJR TaduJR commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Part of #84631, which moves navigation decisions out of the expense actions and into the screens that navigate. This PR changes no behavior.

  1. The split save no longer decides when to write. updateSplitTransactions used to hold its write until a screen change finished whenever isFromSplitExpensesFlow was set. Only the code that navigates knows a screen change is coming, so updateSplitTransactionsFromSplitExpensesFlow now creates that wait and passes it in as writeBarrier. A caller that passes none, like useDeleteTransactions, gets an immediate write, same as before. The flow function also takes a narrower params type, UpdateSplitTransactionsData, so a caller can't hand it a writeBarrier it would ignore.

  2. Flags that change behavior are now required. shouldHandleNavigation and locationPermissionGranted on createTransaction, and shouldHandleNavigation and shouldStartTracking on sendMoney, used to have defaults. A caller could navigate, start tracking, or drop a scan's GPS coordinates just by leaving one out. Every caller now passes the value it was already getting from the default, and TypeScript flags a new caller that forgets one.

  3. The guard test covers more. actionLayerNavigationGuardTest.ts now:

    • fails if any file under src/libs/actions creates its own transition wait (createTransitionBarrier or armTransitionBarrier)
    • scans SendMoney.ts for navigation, since it no longer navigates
    • fails npm run typecheck if an action whose navigation already moved starts returning data
    • lists the 12 actions that still return data. Each entry fails typecheck once its action stops returning, so the later PRs in [$250] Refactor code to keep navigation handling in the UI components #84631 can't lose track of them.
  4. Two comments that called trackExpense void are fixed, since it still returns a value.

Fixed Issues

$ #84631
PROPOSAL: #84631 (comment)

Tests

Split an expense

  1. In Inbox, open your workspace chat, tap the report, and open one expense.
  2. Tap More > Split, then Save.
  3. Verify you land on the report and both split expenses are listed.
  4. Go to Spend > Expenses and pick an expense that was never split. On a wide screen, tick it and tap More > Split. On a phone, open it and tap More > Split.
  5. Tap Save.
  6. Verify you are back on Spend > Expenses, the split expenses are listed, and Expense added appears.
  7. In Inbox, open the chat with your own name marked (you) and open an expense in it.
  8. Tap More > Split, then Save.
  9. Verify you land back in that chat with the split expenses, and no "Hmm... it's not here" page flashes.
  10. Open one of the split expenses from step 3 and tap More > Edit splits.
  11. Tap the other split, tap Remove split, then Save.
  12. Verify you land on the report and the expense is a single expense again.
  13. Open an expense and tap More > Split > Add split > Save, so it is split in three.
  14. Open one of the three and tap More > Delete > Delete.
  15. Verify that one is gone and the other two are still there.

Create an expense

If Create expense opens on the Scan tab, tap Manual. If Allow location access appears, tap Not now.

  1. In Inbox, open your workspace chat and tap + in the message box > Create expense > Manual. Enter an amount and a merchant, then tap Create expense.
  2. Verify you stay in the workspace chat and the report shows one more expense.
  3. Go to Spend > Reports, open a report that is not submitted yet, and tap Add expense > Create expense > Manual. Enter an amount and a merchant, then tap Create expense.
  4. Verify the same report is still open and shows the new expense.
  5. Go to Spend and tap the + button > Create expense > Manual. Keep your workspace as the recipient, enter an amount and a merchant, then tap Create expense.
  6. Verify you land on Spend > Expenses, the new expense is listed, and Expense added appears.
  7. Go to Home and tap + > Create expense > Manual. Tap the recipient at the top and pick yourself under Personal. Enter an amount and a merchant, then tap Create expense.
  8. Verify your (you) chat opens and shows the new expense.

Pay someone

  1. In Inbox, open a chat with another person and tap + in the message box > Pay (their name).
  2. Enter an amount, then tap Pay > Mark as paid.
  3. Verify you land back in the same chat and the payment is shown.
  • Verify that no errors appear in the JS console

Offline tests

Same as tests

QA Steps

Same as tests

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

@TaduJR
TaduJR requested review from a team as code owners October 12, 2026 07:13
@melvin-bot
melvin-bot Bot requested review from garrettmknight and linhvovan29546 and removed request for a team October 12, 2026 07:14
@melvin-bot

melvin-bot Bot commented Oct 12, 2026

Copy link
Copy Markdown

@linhvovan29546 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 a team and removed request for a team October 12, 2026 07:14
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T07:35:44.388945Z 22ae6a3 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codecov

codecov Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

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.

Files with missing lines Coverage Δ
src/libs/actions/IOU/SendMoney.ts 89.87% <100.00%> (-0.13%) ⬇️
src/libs/actions/IOU/SplitTransactionUpdate.ts 92.38% <100.00%> (ø)
...stance/handleMoneyRequestStepDistanceNavigation.ts 83.83% <ø> (ø)
...st/step/confirmation/SubmitExpenseOrchestrator.tsx 61.71% <100.00%> (ø)
...p/confirmation/submission/useDistanceSubmission.ts 95.74% <100.00%> (ø)
...ep/confirmation/submission/useInvoiceSubmission.ts 79.48% <100.00%> (ø)
...nfirmation/submission/useRequestMoneySubmission.ts 90.62% <100.00%> (ø)
.../confirmation/submission/useSendMoneySubmission.ts 77.41% <100.00%> (ø)
...step/confirmation/submission/useSplitSubmission.ts 66.66% <100.00%> (ø)
...nfirmation/submission/useTrackExpenseSubmission.ts 91.66% <100.00%> (ø)
... and 4 more
... and 9 files with indirect coverage changes

@TaduJR

TaduJR commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 22ae6a316f

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

garrettmknight
garrettmknight previously approved these changes Oct 13, 2026

@garrettmknight garrettmknight 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.

Looks good from a product perspective.

@linhvovan29546

Copy link
Copy Markdown
Contributor

@TaduJR Conflicts

…de-to-keep-navigation-handling-in-the-UI-components

# Conflicts:
#	src/libs/actions/IOU/SplitTransactionUpdate.ts
#	src/pages/iou/request/step/confirmation/useExpenseSubmission.ts
#	src/pages/iou/updateSplitTransactionsFromSplitExpensesFlow.ts
#	tests/actions/IOUTest/SplitTest.ts
…de-to-keep-navigation-handling-in-the-UI-components
@TaduJR

TaduJR commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

@TaduJR Conflicts

All done @linhvovan29546

@linhvovan29546

linhvovan29546 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

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 Issues section 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 Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • 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 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 any copy / text that was added to the app 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 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 using Avatar have 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
    • 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
    • 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 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.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • 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 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.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Screen.Recording.2026-10-23.at.18.44.04.mov
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-10-23.at.18.39.08.mov
Screen.Recording.2026-10-23.at.18.39.39.mov
Screen.Recording.2026-10-23.at.18.40.07.mov

@melvin-bot
melvin-bot Bot requested a review from Gonals October 23, 2026 11:46
Gonals
Gonals previously approved these changes Oct 27, 2026
@Gonals

Gonals commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

@TaduJR, can you fix the conflict?

…de-to-keep-navigation-handling-in-the-UI-components

# Conflicts:
#	src/pages/iou/request/step/IOURequestStepConfirmation/index.tsx
…de-to-keep-navigation-handling-in-the-UI-components
@TaduJR

TaduJR commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

@TaduJR, can you fix the conflict?

Done @Gonals

Thanks!

…de-to-keep-navigation-handling-in-the-UI-components

# Conflicts:
#	src/pages/iou/request/step/IOURequestStepConfirmation/index.tsx
#	src/pages/iou/request/step/confirmation/useExpenseSubmission.ts
@TaduJR

TaduJR commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Friendly Bump @Gonals

Thanks!!!

@Gonals
Gonals merged commit 0b1c5f0 into Expensify:main Nov 3, 2026
37 of 38 checks passed
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

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

@OSBotify

OSBotify commented Nov 3, 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.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
Built from App PR #103695 with the pinned Mobile-Expensify submodule.

Android 🤖 iOS 🍎
https://ad-hoc-expensify-cash.s3.us-east-1.amazonaws.com/rock-artifacts/ad-hoc/rock-android-Adhoc-0b1c5f0f-5b2e51a-841c36f21b93a602c8cbf7412ad5c85b6d94b7c2/index.html ❌ FAILED ❌
Android The QR code can't be generated, because the iOS build failed
Web 🕸️
https://103695.pr-testing.expensify.com
Web

👀 View the workflow run that generated this build 👀

@OSBotify OSBotify mentioned this pull request Nov 3, 2026
99 tasks done
@OSBotify

OSBotify commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/Gonals in version: 9.5.31-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

No help site update needed — this PR refactors internal navigation and submission handling without changing user-facing workflows or making existing article instructions incorrect.

@OSBotify

OSBotify commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/Gonals in version: 9.5.31-0 🚀

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

@OSBotify

OSBotify commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/blimpich in version: 9.5.31-4 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 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.

6 participants