Skip to content

Commit c118dd9

Browse files
authored
Merge pull request Expensify#81335 from suhailpthaj/fix/76666
fix: Empty space is shown after clearing the cache or re-signing
2 parents a59c21b + e2358d9 commit c118dd9

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/pages/inbox/report/ReportActionsList.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,14 @@ function ReportActionsList({
805805
);
806806
}, [canShowHeader, retryLoadNewerChatsError]);
807807

808-
const shouldShowSkeleton = isOffline && !sortedVisibleReportActions.some((action) => action.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED);
808+
const shouldShowSkeleton = useMemo(
809+
() => (isOffline || !reportMetadata?.hasOnceLoadedReportActions) && !sortedVisibleReportActions.some((action) => action.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED),
810+
[isOffline, reportMetadata?.hasOnceLoadedReportActions, sortedVisibleReportActions],
811+
);
812+
813+
// While reportActions are loading, use the last reportAction as a fallback
814+
// since it’s available before the rest finish loading.
815+
const reportActionsToRender = useMemo(() => (shouldShowSkeleton ? sortedVisibleReportActions.slice(0, 1) : sortedVisibleReportActions), [shouldShowSkeleton, sortedVisibleReportActions]);
809816

810817
const listFooterComponent = useMemo(() => {
811818
if (!shouldShowSkeleton) {
@@ -860,7 +867,7 @@ function ReportActionsList({
860867
ref={reportScrollManager.ref}
861868
testID="report-actions-list"
862869
style={styles.overscrollBehaviorContain}
863-
data={sortedVisibleReportActions}
870+
data={reportActionsToRender}
864871
renderItem={renderItem}
865872
renderScrollComponent={renderActionSheetAwareScrollView}
866873
contentContainerStyle={[styles.chatContentScrollView, shouldFocusToTopOnMount ? styles.justifyContentEnd : undefined]}

0 commit comments

Comments
 (0)