Skip to content

Commit c471722

Browse files
committed
fix next steps loading state
1 parent 526a0e4 commit c471722

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
@@ -122,14 +122,25 @@ type MoneyReportHeaderProps = {
122122
// eslint-disable-next-line react/no-unused-prop-types
123123
transactionThreadReportID: string | undefined;
124124

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

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

132-
function MoneyReportHeader({policy, report: moneyRequestReport, transactionThreadReportID, reportActions, shouldDisplayBackButton = false, onBackButtonPress}: MoneyReportHeaderProps) {
135+
function MoneyReportHeader({
136+
policy,
137+
report: moneyRequestReport,
138+
transactionThreadReportID,
139+
reportActions,
140+
isLoadingInitialReportActions,
141+
shouldDisplayBackButton = false,
142+
onBackButtonPress,
143+
}: MoneyReportHeaderProps) {
133144
// 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
134145
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
135146
const {shouldUseNarrowLayout, isSmallScreenWidth, isMediumScreenWidth} = useResponsiveLayout();
@@ -892,7 +903,8 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
892903
/>
893904
</View>
894905
)}
895-
{shouldShowNextStep && (optimisticNextStep?.message?.length ? <MoneyReportHeaderStatusBar nextStep={optimisticNextStep} /> : <MoneyReportHeaderStatusBarSkeleton />)}
906+
{shouldShowNextStep && !!optimisticNextStep?.message?.length && <MoneyReportHeaderStatusBar nextStep={optimisticNextStep} />}
907+
{shouldShowNextStep && !optimisticNextStep?.message?.length && !!isLoadingInitialReportActions && <MoneyReportHeaderStatusBarSkeleton />}
896908
{!!statusBarProps && (
897909
<MoneyRequestHeaderStatusBar
898910
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)