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
[Due for payment 2026-03-25] [Due for payment 2026-03-11] Split context providers to return State and Actions separately #80271
Currently, our contexts return a single Context.Provider whose value prop is an object composed of both state and associated callback functions. In most cases, the context is paired with a dedicated hook that provides a convenient and type-safe way for components to consume it. Any change to the context value triggers a re-render of all subscribed components.
Problem
Components that consume only actions from a context provider are still subject to re-renders on context updates, even when they do not directly depend on the provider’s state. It causes higher number of re-renders all across the app.
Solution
Let’s separate State and Actions within the context providers. By exposing two independent providers—one for state and one for actions—we allow components to subscribe only to what they actually need:
Components that depend on state will re-render only when state changes.
Components that use only actions will remain stable and will not re-render in response to state updates.
This separation reduces unnecessary re-renders, improves performance, and makes the intent of each consumer more explicit. It also encourages a clearer mental model by distinguishing between data and behavior at the context level.
Example PR that has improved the performance of the SearchRouter: #79753
Additional note
This also presents an opportunity to do a small cleanup of our context usage. One area for improvement is standardizing how contexts are exposed to consumers by introducing dedicated hooks for each context. Currently, some contexts provide a custom hook (e.g. useExpensifyCardContext), while others are accessed directly via useContext in components (e.g. useContext(KYCWallContext)).
There is also a minor inconsistency in naming conventions, where some providers end with ContextProvider and others with Provider.
While none of this is critical, addressing it as part of this change would improve overall consistency and readability across the codebase.
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.39-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
Activity
46 remaining items
melvin-bot commentedon Mar 18, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Mar 18, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.39-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
eslint-config-expensifyand addcontext-provider-split-valueseslint rule #84274If no regressions arise, payment will be issued on 2026-03-25. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Mar 25, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Mar 26, 2026
Payment Summary
Contributor+: @mkhutornyi due $250 via NewDot
Do we want a test case for this? Close if not. Tag me if so
mkhutornyi commentedon Mar 26, 2026
No need test case. I reviewed 10 PRs linked to this issue:
eslint-config-expensifyand addcontext-provider-split-valueseslint rule #84274mallenexpensify commentedon Apr 1, 2026
@mountiny 👀 above for payment amount for @mkhutornyi .
mountiny commentedon Apr 9, 2026
Overall I think these PRs been large but quite straightforward so I would go with $125 for each PR if that is ok @mkhutornyi to $1250 total
mkhutornyi commentedon Apr 9, 2026
How about $1375 considering #81986 (1.3k lines of code) as standard rate?
mountiny commentedon Apr 10, 2026
Sounds good! @mkhutornyi
mallenexpensify commentedon Apr 13, 2026
Payment Summary
Contributor+: @mkhutornyi due $1375 via NewDot
I think we're good here, comment/reopen if now
trjExpensify commentedon May 6, 2026
approved $1,375 for @mkhutornyi