You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After cancelling the skeleton-blocked spans, we still see many ManualSendMessage spans in the ~1-2s range. This issue tracks the investigation into which real scenarios are the slowest, so we can target them next.
Ideas to check
1. Concierge chats
Look closer at Concierge chats, or chats that include Concierge responses. Some sessions took longer when the Concierge right panel was used to send messages, or when the user chatted with Concierge directly. Worth checking Concierge-related chats on both mobile and web.
Found a user who sent 11 messages, each 2-3s. Worth checking a large account that opens "Spend", then opens a big report with many expenses, then opens a single expense from that list (right side panel) and sends a message there. Many components re-render because of the report + report_action updates.
Add attributes that tell us from which path a message was sent. So far the focus was mostly on chat from the inbox. Knowing the path would help us spot the worst scenario faster, and likely unblocks ideas 1 and 2.
I opened PR #95666, which adds a new send_message_source attribute on the ManualSendMessage. Goal is to see where people send messages, so we can tell which paths are the send-message bottlenecks instead of looking at one blended number.
To track it, I added a table grouped by this attribute to the Sentry dashboard, giving us a distribution per path (with some variants). With it, we will be able drill into a specific user and see whether certain paths are consistently slower
Next, I plan to investigate the 2. Big account, big report, single expense scenario and look for avoidable rerenders.
Nice work on the send_message_source attribute and the dashboard table, this will help us a lot to see which paths are the real bottlenecks.
One small thing: I moved this attribute work into its own issue #95709 and repointed PR #95666 there, so the PR closes something scoped. Let's keep this issue (#95584) as the tracking one for the whole investigation.
+1 on going after the 2. Big account, big report, single expense scenario next. The many re-renders from the report + report_action updates look like the main cost there.
When a user opens the RHP for a specific transaction and sends a message, the heavy lists rerenders.
The rerenders:
Spend results (Search)
RHP with transactions and chat, and finally
currently opened report
... so its quite a lot of elements, and its only my small test account for sending messages
I'm still experimenting, but even after enabling the React Compiler in MoneyRequestReportTransactionList and stabilizing a few things around it, I haven't seen a consistent improvement so far. Many utilities, hooks, and components rely on the full report or reportActions objects, or on related derived values, so they still have to re-render. I'm trying to pass primitive values instead of whole objects where possible and split some logic to make it more suitable for the React Compiler.
Work in progress, sharing where I've landed so far.
I ran a few experiments. First I measured the span in a scenario where the heavy lists underneath are absent (hidden via a dev toggle), and it came out almost 50% faster. So that's effectively the ceiling for this re-render issue.
From there I tried to stabilize the expensive listing as much as possible using an isFocused-gated freeze, React Compiler, and manual memo where the compiler bails. With several small moves stacked together I got roughly -20% to -25% (stabilizing only MoneyRequestReport now)
Next I'll turn these PoC into a plan with achievable, shippable steps, but I need to to some additional testing.
Metric
Baseline
Ceiling (heavy lists hidden)
Current (stabilizing MoneyRequestReport)
Mean
280.5 ms
159.2 ms
209.8 ms (-25%)
Baseline = report view renders normally, no optimization.
Ceiling (heavy lists hidden) = MoneyRequestReportTransactionList and SearchPageWide removed via the dev toggle. Not a shippable implementation (the lists are simply absent).
Current = the focus-gated freeze plus memo() boundaries, with the lists still fully rendered.
The solution seems to be working, but it feels a bit hacky and more like a workaround than a fix for the root cause of the problem - the Onyx subscription call. I'm investigating the subscribed option in the internal useOnyx hook. It would allow us to pause subscriptions on unfocused screens. So far, the initial results look promising. I'm going to do some more testing around this idea, and if it proves to be safe, I'll prepare a proposal for a new Onyx feature:
Thanks for the detailed updates @LukasMod, this is great progress. The Onyx subscribed approach sounds much cleaner than the freeze workaround, and the numbers are promising (−36.7% mean is a big win).
Pausing subscriptions on unfocused screens feels like a good direction for the root cause. Tag me when you post the proposal, and let me know how I can help move it forward.
@cristipaval
Sure! I've shared the proposal internally and I'm waiting on feedback now.
The potential gains look great. Today I experimented further with more aggressive changes and stabilized the list in Spend and, in a heavy scenario, spans dropped by almost 70% 🔥, so there's a lot to gain here, though it also involves a fair number of changes. If this gets approved, I think we should roll it out gradually so we can catch any regressions early.
The feature only pays off once the lists are stable through their other render drivers too, and that adds a bunch of conditions / isFocused checks along the way, together with the standard memoization work. Also, for the first use, we should probably do an AdHoc build and have someone else test it too.
I will update when I get some feedback on Monday 👍
Proposal is after first round of internal feedback. I do some changes to proposal and simplify this feature usage to per screen instead per component/hook. I'm adding new benchmarks and tests, preparing for second round
I shared the proposal internally again. Idea is rewritten, it's now not throttling but freezing when not subscribed. It also showed an improvement in the openReport metric for the screen touched in the PoC (web only, but around 30%). I'm waiting for feedback on this form my team
Meanwhile, I need to verify some logic conditions that could potentially cause regressions if the proposal is accepted, or at least estimate whether they are truly low-risk issues that can be handled without sacrificing the solution
React-navigation 8 is in alpha now but with current proposal there are trades off and additional code complexity. If this will work, focus logic would live where it supposed to - in navigation and not in onyx-around logic
Thanks @LukasMod! I created this subissue to track the report hierarchy subscription work and linked your draft PR there. The approach makes sense to me.
@cristipaval
Here’s the PR addressing the issue with cancelled Concierge spans: #104240 (number 1 from my previous comment and screenshot).
I’m continuing to investigate the second PR to find more opportunities to improve Concierge chat (1 bullet from this issue). I’ve found a few potential leads, but nothing promising yet.
Sounds good @LukasMod, just to let you know Cristi is on parental leave and I will be ooo starting next week. But please keep the updates and investigations coming.
@Julesssss Thanks! Could you create a separate tracking issue for #104240, or should I link it to this issue instead? I’m not sure which issue would be the best fit, as it’s a fairly separate issue but still related to messages
I prepared PR #104242 for concierge problem mentioned in this issue. PR switch the Concierge chat report (and a few rarely changing keys) from useOnyx subscription in render to Onyx.get / Onyx.multiGet when they need it (press handlers). Below you can find some benchmarks from web and iOS. I will prepare all test videos and move to review
1. Sending a message from the Concierge side panel (web) - ManualSendMessageVisible
The side panel sits at the Concierge root with another screen in the central pane
Central pane behind the side panel
before
after
change
Workspace chat with 10 report previews
1614 ms
1242 ms
-23.0%
Self DM with tracked expenses
1441 ms
1355 ms
-6.0%
Spend > Reports
2144 ms
2052 ms
-4.3%
Expense report with header Pay
1663 ms
1617 ms
-2.8%
2. Re-renders per write to the Concierge chat report
I counted React fibers that re-rendered in the central pane and the time React spent committing.
Screen
Web fibers before
after
change
Web commit ms before
after
change
Self DM
756
155
-79%
207
97
-53%
Workspace chat
1754
212
-88%
335
98
-71%
Spend > Reports
2187
842
-61%
898
588
-35%
Expense report
1093
561
-49%
255
154
-40%
Screen
iOS fibers before
after
change
iOS commit ms before
after
change
Self DM
1663
1158
-30%
474
268
-43%
Workspace chat
2427
1310
-46%
807
399
-51%
Spend > Reports
1725
1275
-26%
462
295
-36%
Expense report
1731
1545
-11%
470
331
-30%
These components no longer re-render on a Concierge write: the report actions list and every ChatTransactionPreview in the self DM; every MoneyRequestReportPreview and its Pay SettlementButton in the workspace chat; every ExpenseReportListItem row, its ActionCell and PayActionCell in Spend > Reports; the report actions list and the header SettlementButton on the expense report.
Profiler example (web, Workspace chat):
3. Press handler latency (regression tests)
I measured from the press to the first thing that matters: Navigation.navigate for navigation flows, the first API.write for Pay, and the report becoming visible where one opens.
Flow
Platform
Metric
before
after
change
95% CI
user visible
Spend > Reports row View
web (30 vs 30)
press to navigate
22 ms
24 ms
+2 ms
[-0, +3]
none: press to report visible 971 to 969 ms, [-27, +30]
Header Pay, "Mark as paid"
web (7 vs 8)
press to PayMoneyRequest write
203 ms
251 ms
+48 ms (+24%)
[+30, +62]
none: popover closes at the same time, API response +271 ms [-224, +632]
Header Pay, "Mark as paid"
iOS (8 vs 8)
press to PayMoneyRequest write
375 ms
414 ms
+40 ms (+10%)
[+22, +56]
none: API response +187 ms [-119, +355]
Explain link
web (7 vs 8)
press to navigate
3 ms
4 ms
+1 ms
[-0, +1]
none: first API write 394 to 382 ms, [-29, +39]
Self DM tracked expense preview (thread exists)
iOS (12 vs 12)
press to navigate
2 ms
2 ms
0
[+0, +2]
none: visible 744 to 714 ms, [-196, +206]
Workspace chat report preview
iOS (8 vs 8)
press to navigate
4 ms
5 ms
0
[-2, +3]
none: visible 1102 to 1166 ms, [-63, +222]
The awaited reads hit the cache. Pay moved because closing the popover schedules React work (the MODAL subscribers on web, the popover close state on iOS) that now commits before the handler continues rather than after the API write. The same work runs in both variants in a different order. The server request leaves at the same time and the popover disappears at the same moment.
4. Conclusion
Sending from the Concierge side panel is 23% faster with a chat full of report previews behind it. On the other three panes we saw 3-6% faster
Every Concierge chat write is cheaper on every screen we measured: 49-88% fewer re-rendered fibers on web, 11-46% on iOS, and 30-71% less commit time
No press handler got slower for the user. Navigation flows stay within 2 ms of main. Pay reaches its API write 40 to 48 ms later because a popover-close commit now runs first. The request and the visible close do not change.
@mountiny All the investigations mentioned here have been completed with PRs, and we have a parent issue to track new investigations. I think we can close this one once all the sub-issues are closed as well
Activity
LukasMod commentedon Jul 9, 2026
Part3:
I opened PR #95666, which adds a new
send_message_sourceattribute on theManualSendMessage. Goal is to see where people send messages, so we can tell which paths are the send-message bottlenecks instead of looking at one blended number.To track it, I added a table grouped by this attribute to the Sentry dashboard, giving us a distribution per path (with some variants). With it, we will be able drill into a specific user and see whether certain paths are consistently slower
Next, I plan to investigate the
2. Big account, big report, single expensescenario and look for avoidable rerenders.cristipaval commentedon Jul 9, 2026
Nice work on the
send_message_sourceattribute and the dashboard table, this will help us a lot to see which paths are the real bottlenecks.One small thing: I moved this attribute work into its own issue #95709 and repointed PR #95666 there, so the PR closes something scoped. Let's keep this issue (#95584) as the tracking one for the whole investigation.
+1 on going after the
2. Big account, big report, single expensescenario next. The many re-renders from the report + report_action updates look like the main cost there.LukasMod commentedon Jul 10, 2026
When a user opens the RHP for a specific transaction and sends a message, the heavy lists rerenders.
The rerenders:
... so its quite a lot of elements, and its only my small test account for sending messages
I'm still experimenting, but even after enabling the React Compiler in MoneyRequestReportTransactionList and stabilizing a few things around it, I haven't seen a consistent improvement so far. Many utilities, hooks, and components rely on the full report or reportActions objects, or on related derived values, so they still have to re-render. I'm trying to pass primitive values instead of whole objects where possible and split some logic to make it more suitable for the React Compiler.
I'll continue investigating this next week.
LukasMod commentedon Jul 13, 2026
Work in progress, sharing where I've landed so far.
I ran a few experiments. First I measured the span in a scenario where the heavy lists underneath are absent (hidden via a dev toggle), and it came out almost 50% faster. So that's effectively the ceiling for this re-render issue.
From there I tried to stabilize the expensive listing as much as possible using an
isFocused-gated freeze, React Compiler, and manual memo where the compiler bails. With several small moves stacked together I got roughly -20% to -25% (stabilizing only MoneyRequestReport now)Next I'll turn these PoC into a plan with achievable, shippable steps, but I need to to some additional testing.
MoneyRequestReportTransactionListandSearchPageWideremoved via the dev toggle. Not a shippable implementation (the lists are simply absent).memo()boundaries, with the lists still fully rendered.PoC (middle section memoized)
LukasMod commentedon Jul 14, 2026
The solution seems to be working, but it feels a bit hacky and more like a workaround than a fix for the root cause of the problem - the Onyx subscription call. I'm investigating the
subscribedoption in the internal useOnyx hook. It would allow us to pause subscriptions on unfocused screens. So far, the initial results look promising. I'm going to do some more testing around this idea, and if it proves to be safe, I'll prepare a proposal for a new Onyx feature:WIP PoC:
Draft EApp PR: #95952
Draft Onyx PR: Expensify/react-native-onyx#808
Summary
LukasMod commentedon Jul 15, 2026
Update: Work in progress. I'm testing different ideas and incorporating some initial feedback before creating the proposal.
cristipaval commentedon Jul 17, 2026
Thanks for the detailed updates @LukasMod, this is great progress. The Onyx subscribed approach sounds much cleaner than the freeze workaround, and the numbers are promising (−36.7% mean is a big win).
Pausing subscriptions on unfocused screens feels like a good direction for the root cause. Tag me when you post the proposal, and let me know how I can help move it forward.
LukasMod commentedon Jul 17, 2026
@cristipaval
Sure! I've shared the proposal internally and I'm waiting on feedback now.
The potential gains look great. Today I experimented further with more aggressive changes and stabilized the list in Spend and, in a heavy scenario, spans dropped by almost 70% 🔥, so there's a lot to gain here, though it also involves a fair number of changes. If this gets approved, I think we should roll it out gradually so we can catch any regressions early.
The feature only pays off once the lists are stable through their other render drivers too, and that adds a bunch of conditions / isFocused checks along the way, together with the standard memoization work. Also, for the first use, we should probably do an AdHoc build and have someone else test it too.
I will update when I get some feedback on Monday 👍
LukasMod commentedon Jul 20, 2026
Update:
New draft PoC: #96471
Based by the same onyx change as before: Expensify/react-native-onyx#808
LukasMod commentedon Jul 21, 2026
Update:
Draft PoC: #96471
Onyx subscribed: Expensify/react-native-onyx#808
LukasMod commentedon Jul 27, 2026
Update:
https://www.callstack.com/blog/keeping-screens-visible-with-activity-mode-hidden, https://reactnavigation.org/blog/2026/03/10/react-navigation-8.0-march-progress#new-inactivebehavior-option-for-all-navigators
React-navigation 8 is in alpha now but with current proposal there are trades off and additional code complexity. If this will work, focus logic would live where it supposed to - in navigation and not in onyx-around logic
51 remaining items
cristipaval commentedon Oct 13, 2026
Thanks @LukasMod! I created this subissue to track the report hierarchy subscription work and linked your draft PR there. The approach makes sense to me.
LukasMod commentedon Oct 16, 2026
Two new findings on the Concierge topic while investigating this issue:
LukasMod commentedon Oct 20, 2026
@cristipaval
Here’s the PR addressing the issue with cancelled Concierge spans: #104240 (number 1 from my previous comment and screenshot).
I’m continuing to investigate the second PR to find more opportunities to improve Concierge chat (1 bullet from this issue). I’ve found a few potential leads, but nothing promising yet.
Julesssss commentedon Oct 21, 2026
Sounds good @LukasMod, just to let you know Cristi is on parental leave and I will be ooo starting next week. But please keep the updates and investigations coming.
LukasMod commentedon Oct 21, 2026
@Julesssss Thanks! Could you create a separate tracking issue for #104240, or should I link it to this issue instead? I’m not sure which issue would be the best fit, as it’s a fairly separate issue but still related to messages
Julesssss commentedon Oct 21, 2026
Yeah sure, sub-issue here.
LukasMod commentedon Nov 2, 2026
I prepared PR #104242 for concierge problem mentioned in this issue. PR switch the Concierge chat report (and a few rarely changing keys) from useOnyx subscription in render to Onyx.get / Onyx.multiGet when they need it (press handlers). Below you can find some benchmarks from web and iOS. I will prepare all test videos and move to review
1. Sending a message from the Concierge side panel (web) -
ManualSendMessageVisibleThe side panel sits at the Concierge root with another screen in the central pane
2. Re-renders per write to the Concierge chat report
I counted React fibers that re-rendered in the central pane and the time React spent committing.
These components no longer re-render on a Concierge write: the report actions list and every
ChatTransactionPreviewin the self DM; everyMoneyRequestReportPreviewand its PaySettlementButtonin the workspace chat; everyExpenseReportListItemrow, itsActionCellandPayActionCellin Spend > Reports; the report actions list and the headerSettlementButtonon the expense report.Profiler example (web, Workspace chat):
3. Press handler latency (regression tests)
I measured from the press to the first thing that matters:
Navigation.navigatefor navigation flows, the firstAPI.writefor Pay, and the report becoming visible where one opens.The awaited reads hit the cache. Pay moved because closing the popover schedules React work (the
MODALsubscribers on web, the popover close state on iOS) that now commits before the handler continues rather than after the API write. The same work runs in both variants in a different order. The server request leaves at the same time and the popover disappears at the same moment.4. Conclusion
LukasMod commentedon Nov 5, 2026
@mountiny All the investigations mentioned here have been completed with PRs, and we have a parent issue to track new investigations. I think we can close this one once all the sub-issues are closed as well
mountiny commentedon Nov 5, 2026
Thanks!