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][$250] [Performance] Remove duplicate call to useLoadingBarVisibility #85428
Remove duplicate useLoadingBarVisibility() from TopBar.
Both SearchSidebar and TopBar independently subscribed to the same Onyx keys (PERSISTED_REQUESTS, PERSISTED_ONGOING_REQUESTS). Now TopBar receives the value via prop; callers that relied on the internal fallback (BaseSidebarScreen, InitialSettingsPage, WorkspacesListPage) pass it explicitly.
Issue OwnerCurrent Issue Owner: @mallenexpensifyUpwork Automation - Do Not Edit
Please re-state the problem that we are trying to solve in this issue.
On wide layouts, SearchSidebar and screens like BaseSidebarScreen (Inbox) can be mounted simultaneously. Both independently subscribe to the same Onyx keys (PERSISTED_REQUESTS and PERSISTED_ONGOING_REQUESTS) via separate calls to useLoadingBarVisibility() — one inside SearchSidebar and one inside TopBarWithLoadingBar (which wraps TopBar). This creates duplicate Onyx subscriptions and unnecessary re-renders.
What is the root cause of that problem?
TopBarWithLoadingBar (App/src/components/Navigation/TopBarWithLoadingBar.tsx) is a convenience wrapper that internally calls useLoadingBarVisibility() and passes the result to TopBar via the shouldShowLoadingBar prop. Three callers use this wrapper:
Meanwhile, SearchSidebar and SearchPageNarrow already use TopBar directly and call useLoadingBarVisibility() at the caller level, passing the result as a prop. When a screen using TopBarWithLoadingBar is mounted alongside SearchSidebar (wide layout), both create their own subscriptions to the same two Onyx keys, resulting in redundant work.
What changes do you think we should make in order to solve the problem?
Update the three callers (BaseSidebarScreen, InitialSettingsPage, WorkspacesListPage) to import and call useLoadingBarVisibility() themselves, then use TopBar directly instead of TopBarWithLoadingBar, passing the result as the shouldShowLoadingBar prop.
Delete TopBarWithLoadingBar (App/src/components/Navigation/TopBarWithLoadingBar.tsx) since it will no longer have any consumers.
This follows the same pattern already used by SearchSidebar and SearchPageNarrow, where the caller owns the hook call and passes the value down as a prop to TopBar.
What alternative solutions did you explore? (Optional)
An alternative would be to lift useLoadingBarVisibility() to a shared context/provider so all components read from a single subscription. However, that adds architectural complexity for what is effectively a simple prop-drilling fix. The caller-owns-the-hook pattern is already established in SearchSidebar and SearchPageNarrow, so extending it to the three remaining callers is the simplest and most consistent approach.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
changed the title [-][Performance] Remove duplicate call to useLoadingBarVisibility[/-][+][$250] [Performance] Remove duplicate call to useLoadingBarVisibility[/+]on Mar 16, 2026
Please re-state the problem that we are trying to solve in this issue.
On wide layouts, SearchSidebar and screens like BaseSidebarScreen (Inbox) are mounted simultaneously. Both independently subscribe to the same Onyx keys (PERSISTED_REQUESTS and PERSISTED_ONGOING_REQUESTS) via separate calls to useLoadingBarVisibility() — one inside SearchSidebar and one inside TopBarWithLoadingBar (which wraps TopBar). This creates duplicate Onyx subscriptions and unnecessary re-renders.
What is the root cause of that problem?
TopBarWithLoadingBar (App/src/components/Navigation/TopBarWithLoadingBar.tsx) is a wrapper that internally calls useLoadingBarVisibility() and passes the result to TopBar via the shouldShowLoadingBar prop. Three callers use this wrapper:
Meanwhile, SearchSidebar and SearchPageNarrow already call useLoadingBarVisibility() at the caller level and pass the result as a prop to TopBar directly. This inconsistency means the TopBarWithLoadingBar wrapper is the source of the duplicate subscriptions.
What changes do you think we should make in order to solve the problem?
Update the three callers (BaseSidebarScreen, InitialSettingsPage, WorkspacesListPage) to:
Import and call useLoadingBarVisibility() directly
Replace TopBarWithLoadingBar with TopBar, passing the result via the shouldShowLoadingBar prop
Delete TopBarWithLoadingBar (App/src/components/Navigation/TopBarWithLoadingBar.tsx) since it will have no remaining consumers.
This aligns all callers with the pattern already established by SearchSidebar and SearchPageNarrow, where the caller owns the hook call and passes the value down as a prop.
What alternative solutions did you explore? (Optional)
Lifting useLoadingBarVisibility() to a shared context/provider so all components read from a single subscription. However, this adds architectural complexity for what is effectively a simple prop-drilling fix. The caller-owns-the-hook pattern is already established, so extending it to the three remaining callers is the simplest and most consistent approach.
I'd like to work on this performance fix. I'll remove the duplicate useLoadingBarVisibility() call from TopBar and update callers to pass the value via props. Expected completion: 1-2 hours.
📣 @buyuan-dev! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
@buyuan-dev This issue is not open for proposals - note that there is no Help wanted label. Please refrain from opening PRs without being assigned and ensure you read our contributing guide to understand how you can positively contribute to the project.
Activity
MelvinBot commentedon Mar 16, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On wide layouts,
SearchSidebarand screens likeBaseSidebarScreen(Inbox) can be mounted simultaneously. Both independently subscribe to the same Onyx keys (PERSISTED_REQUESTSandPERSISTED_ONGOING_REQUESTS) via separate calls touseLoadingBarVisibility()— one insideSearchSidebarand one insideTopBarWithLoadingBar(which wrapsTopBar). This creates duplicate Onyx subscriptions and unnecessary re-renders.What is the root cause of that problem?
TopBarWithLoadingBar(App/src/components/Navigation/TopBarWithLoadingBar.tsx) is a convenience wrapper that internally callsuseLoadingBarVisibility()and passes the result toTopBarvia theshouldShowLoadingBarprop. Three callers use this wrapper:BaseSidebarScreen(App/src/pages/inbox/sidebar/BaseSidebarScreen.tsx:56-60)InitialSettingsPage(App/src/pages/settings/InitialSettingsPage.tsx:563-567)WorkspacesListPage(App/src/pages/workspace/WorkspacesListPage.tsx:739-744)Meanwhile,
SearchSidebarandSearchPageNarrowalready useTopBardirectly and calluseLoadingBarVisibility()at the caller level, passing the result as a prop. When a screen usingTopBarWithLoadingBaris mounted alongsideSearchSidebar(wide layout), both create their own subscriptions to the same two Onyx keys, resulting in redundant work.What changes do you think we should make in order to solve the problem?
Update the three callers (
BaseSidebarScreen,InitialSettingsPage,WorkspacesListPage) to import and calluseLoadingBarVisibility()themselves, then useTopBardirectly instead ofTopBarWithLoadingBar, passing the result as theshouldShowLoadingBarprop.Delete
TopBarWithLoadingBar(App/src/components/Navigation/TopBarWithLoadingBar.tsx) since it will no longer have any consumers.This follows the same pattern already used by
SearchSidebarandSearchPageNarrow, where the caller owns the hook call and passes the value down as a prop toTopBar.What alternative solutions did you explore? (Optional)
An alternative would be to lift
useLoadingBarVisibility()to a shared context/provider so all components read from a single subscription. However, that adds architectural complexity for what is effectively a simple prop-drilling fix. The caller-owns-the-hook pattern is already established inSearchSidebarandSearchPageNarrow, so extending it to the three remaining callers is the simplest and most consistent approach.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.melvin-bot commentedon Mar 16, 2026
Current assignee @jjcoffee is eligible for the External assigner, not assigning anyone new.
[-][Performance] Remove duplicate call to useLoadingBarVisibility[/-][+][$250] [Performance] Remove duplicate call to useLoadingBarVisibility[/+]melvin-bot commentedon Mar 16, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022033574600145585267
AbdulMoiz-Ali commentedon Mar 16, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On wide layouts,
SearchSidebarand screens likeBaseSidebarScreen(Inbox) are mounted simultaneously. Both independently subscribe to the same Onyx keys (PERSISTED_REQUESTSandPERSISTED_ONGOING_REQUESTS) via separate calls touseLoadingBarVisibility()— one insideSearchSidebarand one insideTopBarWithLoadingBar(which wrapsTopBar). This creates duplicate Onyx subscriptions and unnecessary re-renders.What is the root cause of that problem?
TopBarWithLoadingBar(App/src/components/Navigation/TopBarWithLoadingBar.tsx) is a wrapper that internally callsuseLoadingBarVisibility()and passes the result toTopBarvia theshouldShowLoadingBarprop. Three callers use this wrapper:BaseSidebarScreen(App/src/pages/Inbox/sidebar/BaseSidebarScreen.tsx)InitialSettingsPage(App/src/pages/settings/InitialSettingsPage.tsx)WorkspacesListPage(App/src/pages/workspace/WorkspacesListPage.tsx)Meanwhile,
SearchSidebarandSearchPageNarrowalready calluseLoadingBarVisibility()at the caller level and pass the result as a prop toTopBardirectly. This inconsistency means theTopBarWithLoadingBarwrapper is the source of the duplicate subscriptions.What changes do you think we should make in order to solve the problem?
Update the three callers (
BaseSidebarScreen,InitialSettingsPage,WorkspacesListPage) to:useLoadingBarVisibility()directlyTopBarWithLoadingBarwithTopBar, passing the result via theshouldShowLoadingBarpropDelete
TopBarWithLoadingBar(App/src/components/Navigation/TopBarWithLoadingBar.tsx) since it will have no remaining consumers.This aligns all callers with the pattern already established by
SearchSidebarandSearchPageNarrow, where the caller owns the hook call and passes the value down as a prop.What alternative solutions did you explore? (Optional)
useLoadingBarVisibility()to a shared context/provider so all components read from a single subscription. However, this adds architectural complexity for what is effectively a simple prop-drilling fix. The caller-owns-the-hook pattern is already established, so extending it to the three remaining callers is the simplest and most consistent approach.21 remaining items
buyuan-dev commentedon Mar 20, 2026
I'd like to work on this performance fix. I'll remove the duplicate useLoadingBarVisibility() call from TopBar and update callers to pass the value via props. Expected completion: 1-2 hours.
melvin-bot commentedon Mar 20, 2026
📣 @buyuan-dev! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
buyuan-dev commentedon Mar 20, 2026
jjcoffee commentedon Mar 20, 2026
@buyuan-dev This issue is not open for proposals - note that there is no
Help wantedlabel. Please refrain from opening PRs without being assigned and ensure you read our contributing guide to understand how you can positively contribute to the project.melvin-bot commentedon Mar 23, 2026
@mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
melvin-bot commentedon Mar 23, 2026
@mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
jjcoffee commentedon Mar 24, 2026
Noting that no checklist or regression test is required here as this was just a performance refactor.
mallenexpensify commentedon Mar 25, 2026
Payment Summary
Contributor+: @jjcoffee due $250 via NewDot
JmillsExpensify commentedon Mar 29, 2026
$250 approved for @jjcoffee