Skip to content

Commit 74f6f40

Browse files
mountinyOSBotify
authored andcommitted
Merge pull request #62768 from software-mansion-labs/@szymczak/fix-next-steps-loading-state
[CP Staging] Fix next steps loading state (cherry picked from commit a76fe90) (cherry-picked to staging by mountiny)
1 parent de384e0 commit 74f6f40

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

src/components/MoneyReportHeader.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,25 @@ type MoneyReportHeaderProps = {
121121
// eslint-disable-next-line react/no-unused-prop-types
122122
transactionThreadReportID: string | undefined;
123123

124+
/** whether we are loading report data in openReport command */
125+
isLoadingInitialReportActions?: boolean;
126+
124127
/** Whether back button should be displayed in header */
125128
shouldDisplayBackButton?: boolean;
126129

127130
/** Method to trigger when pressing close button of the header */
128131
onBackButtonPress: () => void;
129132
};
130133

131-
function MoneyReportHeader({policy, report: moneyRequestReport, transactionThreadReportID, reportActions, shouldDisplayBackButton = false, onBackButtonPress}: MoneyReportHeaderProps) {
134+
function MoneyReportHeader({
135+
policy,
136+
report: moneyRequestReport,
137+
transactionThreadReportID,
138+
reportActions,
139+
isLoadingInitialReportActions,
140+
shouldDisplayBackButton = false,
141+
onBackButtonPress,
142+
}: MoneyReportHeaderProps) {
132143
// We need to use isSmallScreenWidth instead of shouldUseNarrowLayout to use a correct layout for the hold expense modal https://github.com/Expensify/App/pull/47990#issuecomment-2362382026
133144
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
134145
const {shouldUseNarrowLayout, isSmallScreenWidth, isMediumScreenWidth} = useResponsiveLayout();
@@ -891,7 +902,8 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
891902
/>
892903
</View>
893904
)}
894-
{shouldShowNextStep && (optimisticNextStep?.message?.length ? <MoneyReportHeaderStatusBar nextStep={optimisticNextStep} /> : <MoneyReportHeaderStatusBarSkeleton />)}
905+
{shouldShowNextStep && !!optimisticNextStep?.message?.length && <MoneyReportHeaderStatusBar nextStep={optimisticNextStep} />}
906+
{shouldShowNextStep && !optimisticNextStep?.message?.length && !!isLoadingInitialReportActions && <MoneyReportHeaderStatusBarSkeleton />}
895907
{!!statusBarProps && (
896908
<MoneyRequestHeaderStatusBar
897909
icon={statusBarProps.icon}

src/components/MoneyRequestReportView/MoneyRequestReportView.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ function MoneyRequestReportView({report, policy, reportMetadata, shouldDisplayRe
167167
policy={policy}
168168
reportActions={reportActions}
169169
transactionThreadReportID={transactionThreadReportID}
170+
isLoadingInitialReportActions={isLoadingInitialReportActions}
170171
shouldDisplayBackButton
171172
onBackButtonPress={() => {
172173
if (!backToRoute) {
@@ -177,7 +178,7 @@ function MoneyRequestReportView({report, policy, reportMetadata, shouldDisplayRe
177178
}}
178179
/>
179180
),
180-
[activeWorkspaceID, backToRoute, isTransactionThreadView, parentReportAction, policy, report, reportActions, transactionThreadReportID],
181+
[activeWorkspaceID, backToRoute, isLoadingInitialReportActions, isTransactionThreadView, parentReportAction, policy, report, reportActions, transactionThreadReportID],
181182
);
182183

183184
if (!!(isLoadingInitialReportActions && reportActions.length === 0 && !isOffline) || shouldWaitForData) {

src/pages/home/ReportScreen.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
380380
report={report}
381381
policy={policy}
382382
transactionThreadReportID={transactionThreadReportID}
383+
isLoadingInitialReportActions={reportMetadata.isLoadingInitialReportActions}
383384
reportActions={reportActions}
384385
onBackButtonPress={onBackButtonPress}
385386
/>

0 commit comments

Comments
 (0)