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
{{ message }}
Repository navigation
Remove initSplitExpense, as it encourages bad practices #82711
Coming from #82684, we have removed initSplitExpense where necessary for the changes (replacing it with useSplitExpense). However, this method is used all throughout the codebase, leading to a ton of excessive subscriptions to collections. Lets remove it
initSplitExpense establishes subscriptions imperatively and is invoked in multiple components throughout the codebase. This leads to redundant and unnecessary subscriptions, increasing complexity and potentially impacting performance.
The newer useSplitExpense hook provides a more idiomatic and controlled way to manage these subscriptions within React’s lifecycle, but the migration is currently incomplete.
What changes do you think we should make in order to solve the problem?
Ensure that all related logic previously handled by initSplitExpense is properly covered by useSplitExpense, and verify that no redundant Onyx subscriptions remain after the migration.
What alternative solutions did you explore? (Optional)
Activity
truph01 commentedon Feb 18, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?
initSplitExpenseestablishes subscriptions imperatively and is invoked in multiple components throughout the codebase. This leads to redundant and unnecessary subscriptions, increasing complexity and potentially impacting performance.useSplitExpensehook provides a more idiomatic and controlled way to manage these subscriptions within React’s lifecycle, but the migration is currently incomplete.What changes do you think we should make in order to solve the problem?
Wait until [NO QA] Reduce re-renders & remove global reports subscription in report action list #82684 is merged to avoid conflicts and ensure consistency with the recent refactor.
Replace all remaining usages of
initSplitExpensewith theuseSplitExpensehook:App/src/components/MoneyReportHeader.tsx
Line 1386 in 18d24f4
App/src/components/MoneyRequestHeader.tsx
Line 439 in 18d24f4
App/src/pages/Search/SearchPage.tsx
Line 1050 in 18d24f4
App/src/components/ReportActionItem/MoneyRequestView.tsx
Line 611 in 18d24f4
Ensure that all related logic previously handled by
initSplitExpenseis properly covered byuseSplitExpense, and verify that no redundant Onyx subscriptions remain after the migration.What alternative solutions did you explore? (Optional)