Repository navigation
Decompose ReportScreen core subcomponents #83560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rlinoz
merged 11 commits into
Expensify:main
from
callstack-internal:decompose-findings-4
Feb 27, 2026
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0c7fb17
Move isComposerFullSize subscription into ReportFooter
adhorodyski a219547
Tighten ReportFooter interface and remove manual memo comparators
adhorodyski d7c53c2
Narrow HeaderView's expensive Onyx subscriptions with selectors
adhorodyski f0afa20
Extract LoadingBar into HeaderLoadingBar to isolate SequentialQueue r…
adhorodyski a22f3d2
Reuse HeaderLoadingBar in MoneyReportHeader and MoneyRequestHeader to…
adhorodyski 423d69e
Narrow Network subscriptions in MoneyReportHeader and MoneyRequestHea…
adhorodyski 67a719d
Merge exfy/main: resolve conflict in HeaderView.tsx
adhorodyski 0cc622e
Fix canEvict error in useParentReportAction when parentReportID is un…
adhorodyski abf0deb
Merge branch 'Expensify:main' into decompose-findings-4
adhorodyski 9759d7e
Move HeaderView selectors to dedicated files and add unit tests
adhorodyski 66bf420
add missing react import
adhorodyski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import React from 'react'; | ||
| import useLoadingBarVisibility from '@hooks/useLoadingBarVisibility'; | ||
| import useResponsiveLayout from '@hooks/useResponsiveLayout'; | ||
| import LoadingBar from './LoadingBar'; | ||
|
|
||
| function HeaderLoadingBar() { | ||
| const {shouldUseNarrowLayout} = useResponsiveLayout(); | ||
| const shouldShowLoadingBar = useLoadingBarVisibility(); | ||
|
|
||
| return <LoadingBar shouldShow={shouldShowLoadingBar && shouldUseNarrowLayout} />; | ||
| } | ||
|
|
||
| export default HeaderLoadingBar; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,30 @@ | ||
| import type {OnyxEntry} from 'react-native-onyx'; | ||
| import {WRITE_COMMANDS} from '@libs/API/types'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import type {AnyRequest} from '@src/types/onyx'; | ||
| import useNetwork from './useNetwork'; | ||
| import useOnyx from './useOnyx'; | ||
|
|
||
| // Commands that should trigger the LoadingBar to show | ||
| const RELEVANT_COMMANDS = new Set<string>([WRITE_COMMANDS.OPEN_APP, WRITE_COMMANDS.RECONNECT_APP, WRITE_COMMANDS.OPEN_REPORT, WRITE_COMMANDS.READ_NEWEST_ACTION]); | ||
|
|
||
| const persistedRequestsSelector = (requests: OnyxEntry<AnyRequest[]>) => !!requests?.some((r) => RELEVANT_COMMANDS.has(r.command) && !r.initiatedOffline); | ||
|
|
||
| const ongoingRequestSelector = (request: OnyxEntry<AnyRequest>) => !!request && RELEVANT_COMMANDS.has(request.command); | ||
|
|
||
| /** | ||
| * Hook that determines whether LoadingBar should be visible based on active queue requests | ||
| * Shows LoadingBar when any of the RELEVANT_COMMANDS are being processed | ||
| */ | ||
| export default function useLoadingBarVisibility(): boolean { | ||
| const [persistedRequests] = useOnyx(ONYXKEYS.PERSISTED_REQUESTS); | ||
| const [ongoingRequests] = useOnyx(ONYXKEYS.PERSISTED_ONGOING_REQUESTS); | ||
| const [hasRelevantPersistedRequests] = useOnyx(ONYXKEYS.PERSISTED_REQUESTS, {selector: persistedRequestsSelector}); | ||
| const [hasRelevantOngoingRequest] = useOnyx(ONYXKEYS.PERSISTED_ONGOING_REQUESTS, {selector: ongoingRequestSelector}); | ||
| const {isOffline} = useNetwork(); | ||
|
|
||
| // Don't show loading bar if currently offline | ||
| if (isOffline) { | ||
| return false; | ||
| } | ||
|
|
||
| const hasPersistedRequests = !!persistedRequests?.some((request) => RELEVANT_COMMANDS.has(request.command) && !request.initiatedOffline); | ||
| const hasOngoingRequests = !!ongoingRequests && RELEVANT_COMMANDS.has(ongoingRequests?.command); | ||
|
|
||
| return hasPersistedRequests || hasOngoingRequests; | ||
| return !!hasRelevantPersistedRequests || !!hasRelevantOngoingRequest; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.