Repository navigation
Description
Problem
SplitExpense-SaveButton has the worst p75 INP of any labelled interaction in the app, and it is trending the wrong way. The "good" threshold is 200 ms; anything over 500 ms is "poor".
| Window | p75 INP | Interactions | Severity count × (p75−200)² |
|---|---|---|---|
| 14d | 800.0 ms | 230 | 53M |
| 7d | 816.0 ms | 139 | 53M |
Where it is
- Label constant:
CONST.SENTRY_LABEL.SPLIT_EXPENSE.SAVE_BUTTON(src/CONST/index.ts) - Applied in
src/pages/iou/SplitExpensePage.tsx, on the Save button - Handler:
onSaveSplitExpensein the same file
Hypothesis: whole-collection Onyx subscriptions
SplitExpensePage.tsx subscribes to eight Onyx collections, seven of them unfiltered:
| Subscription | Selector? |
|---|---|
useOnyx(ONYXKEYS.COLLECTION.REPORT) |
no |
useOnyx(ONYXKEYS.COLLECTION.REPORT_ACTIONS) |
no |
useOnyx(ONYXKEYS.COLLECTION.POLICY) |
no |
useOnyx(ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS) |
no |
useOnyx(ONYXKEYS.COLLECTION.SNAPSHOT) |
no |
useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS) |
no |
useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST) |
no |
useOnyx(ONYXKEYS.COLLECTION.POLICY_TAGS, {selector: ...}) |
yes |
plus useAllTransactions(). Every one of these except POLICY_TAGS is read whole and then handed straight into updateSplitTransactionsFromSplitExpensesFlow as allTransactionsList, allReportsList, allReportActionsList, allReportNameValuePairsList, allSnapshots, allPolicyTags.
This is the fix that has already been proven to work
Remove redundant Onyx subscriptions when editing IOURequest (PR #90338) attacked exactly this class of problem and is the one fix in this programme that demonstrably moved production p75. Every RequestConfirmationList-* field it touched now sits at 136–184 ms, comfortably under the threshold.
Read that PR before proposing anything here.
Secondary cost on the press
onSaveSplitExpense runs up to three deepEqual comparisons over the full split set and its child transactions before it does anything useful, plus computeSplitSaveErrorMessage. These are synchronous and sit on the critical path to paint.
A high-traffic account is mandatory here
On a fresh account these collections are tiny and this bug is invisible — you will measure a fast button and conclude there is nothing to fix.
Reproduce and measure with a high-traffic account against the staging or production API, per PERFORMANCE.md §4.
Reference
- PERFORMANCE.md — performance contributing guidelines, profiling tooling, and the
[Performance Proposal]template a proposal here should follow - INP_IMPROVEMENT_WORKFLOW.md — the INP-specific workflow
- INTERACTION_MANAGER.md — deferral primitives, and when not to reach for them
- Sentry dashboard: INP by label
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022084660145054387781
- Upwork Job ID: 2084660145054387781
- Last Price Increase: 2026-08-04
Activity
melvin-bot commentedon Aug 4, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ikevin127 (
External)melvin-bot commentedon Aug 4, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022084660145054387781
[-][INP] Improve `SplitExpense-SaveButton` interaction[/-][+][$250] [INP] Improve `SplitExpense-SaveButton` interaction[/+]j3ffffff commentedon Aug 4, 2026
lorretheboy commentedon Aug 4, 2026
Proposal
What is the root cause of that problem?
SplitExpensePageholds eight unfiltered Onyx subscriptions, but three of them (REPORT_NAME_VALUE_PAIRS,SNAPSHOT,PERSONAL_DETAILS_LIST) are never used in render at all — they exist purely to be forwarded as arguments to the save action — and two more (REPORT_ACTIONS,TRANSACTION_VIOLATIONS) are only read for a single key each:App/src/pages/iou/SplitExpensePage.tsx
Lines 124 to 126 in 51ca7a0
App/src/pages/iou/SplitExpensePage.tsx
Lines 239 to 241 in 51ca7a0
The causal chain on the press:
onSaveSplitExpensesynchronously callsupdateSplitTransactionsFromSplitExpensesFlow, which builds optimistic money-request data for every split and commits Onyx writes to the transaction, report, report-actions and snapshot collections → those are exactly the collections this page subscribes to whole, so every commit rebuilds the huge collection snapshots and re-renders the page's expensive unmemoized body (per-splitisSplitAction,getTransactionDetails, theoptionsmapping) — several times, all before the frame can paint. On a high-traffic account those collections are large, which is why p75 sits at ~800 ms while a fresh account looks fine.The collections are only handed straight through here:
App/src/pages/iou/SplitExpensePage.tsx
Lines 372 to 378 in 51ca7a0
This is the same class of problem as PR #90338 (redundant Onyx traffic on the save path); that PR didn't touch this page, so this isn't a regression from it — the pattern was simply never applied here.
What changes do you think we should make in order to solve the problem?
Fix at the action level, since
SplitExpensePageis the only caller ofupdateSplitTransactionsFromSplitExpensesFlow. The IOU actions module already keepsOnyx.connect-backed caches with getters for every one of these collections — andSplitTransactionUpdate.tsalready imports one of them:App/src/libs/actions/IOU/index.ts
Lines 148 to 190 in 51ca7a0
App/src/libs/actions/IOU/SplitTransactionUpdate.ts
Line 81 in 51ca7a0
So:
updateSplitTransactionsFromSplitExpensesFlow, drop theallTransactionsList/allReportsList/allReportActionsList/allReportNameValuePairsList/allSnapshots/personalDetails/transactionViolationsparams and read them at call time viagetAllTransactions,getAllReports,getAllReportActionsFromIOU,getAllReportNameValuePairs,getAllSnapshots,getAllPersonalDetails,getAllTransactionViolations. These are press-time snapshot reads, so freshness is identical to what the subscriptions provided.SplitExpensePage, delete the subscriptions that only fed the action (REPORT_NAME_VALUE_PAIRS,SNAPSHOT,PERSONAL_DETAILS_LIST), and narrow the two collections the render reads a single key from: subscribe to${REPORT_ACTIONS}${iouReportIDForActions}instead of the whole collection (its only render use is the lookup iniouActions), and to${TRANSACTION_VIOLATIONS}${transactionID}(only used forcurrentTransactionViolations).deepEqual(splitFieldDataFromChildTransactions, splitExpenses)is computed in two places inonSaveSplitExpense; compute it once.REPORT,POLICYand the transactions collection are genuinely used throughout the render, so they stay (narrowing them with selectors can be a follow-up). After the change, the optimistic writes from the save no longer re-render this page through five now-removed/narrowed subscriptions, and the page stops re-rendering on unrelated updates to those collections while open. Verify with a high-traffic account per PERFORMANCE.md, comparing React Profiler traces of the Save press before/after.What alternative solutions did you explore? (Optional)
Keeping the action's signature and instead reading the collections inside
onSaveSplitExpenseat press time from the same getters. It gives the identical INP win, but leaves a misleading API that invites the next caller to reintroduce whole-collection subscriptions, so changing the action (single call site) is cleaner.112 remaining items
mallenexpensify commentedon Oct 5, 2026
Payment Summary
Contributor: @Abdukhamid000 paid $125 via Upwork
Contributor+: @ikevin127 due $125 via NewDot
@Abdukhamid000 can you please apply to the job below? Please reply here and tag me once you have.
I'm assuming pay is half for the deploy blocker and revert, comment if you disagree.
ikevin127 commentedon Oct 5, 2026
Thanks for the summary, I'll be requesting $125 as well even though it says $250 (probably typo) 🙌
mallenexpensify commentedon Oct 5, 2026
yup, apologies. updated to $125
Abdukhamid000 commentedon Oct 6, 2026
@mallenexpensify in link saying This job is no longer available.
mallenexpensify commentedon Oct 6, 2026
@Abdukhamid000 can you try again, it's showing as open to me
https://www.upwork.com/jobs/~022107115148034462931
If you're still having troubles, please share your upwork profile link
Abdukhamid000 commentedon Oct 7, 2026
@mallenexpensify applied
mallenexpensify commentedon Oct 7, 2026
@Abdukhamid000 can you please accept the job below? Please reply here and tag me once you have.
https://www.upwork.com/jobs/~022107115148034462931
Abdukhamid000 commentedon Oct 8, 2026
Thanks @mallenexpensify I've accepted the offer on Upwork and submitted the job. 🙏
mallenexpensify commentedon Oct 8, 2026
@Abdukhamid000 paid, summary updated above. Thx.
quinthar commentedon Oct 13, 2026
Approved $125 to @ikevin127