Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function MoneyRequestReportPreviewContent({
onPress,
}: MoneyRequestReportPreviewContentProps) {
const [chatReportMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${chatReportID}`, {canBeMissing: true, allowStaleData: true});
const shouldShowLoading = !chatReportMetadata?.hasOnceLoadedReportActions && transactions.length === 0;
const shouldShowLoading = !chatReportMetadata?.hasOnceLoadedReportActions && transactions.length === 0 && !chatReportMetadata?.isOptimisticReport;
// `hasOnceLoadedReportActions` becomes true before transactions populate fully,
// so we defer the loading state update to ensure transactions are loaded
const shouldShowLoadingDeferred = useDeferredValue(shouldShowLoading);
Expand Down
5 changes: 2 additions & 3 deletions src/pages/home/ReportScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
);

const fetchReport = useCallback(() => {
if (reportMetadata.isOptimisticReport && report?.type === CONST.REPORT.TYPE.CHAT) {
if (reportMetadata.isOptimisticReport && report?.type === CONST.REPORT.TYPE.CHAT && !isPolicyExpenseChat(report)) {
return;
}

Expand All @@ -487,8 +487,7 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
openReport(reportIDFromRoute, reportActionIDFromRoute);
}, [
reportMetadata.isOptimisticReport,
report?.type,
report?.errorFields?.notFound,
report,
isOffline,
route.params?.moneyRequestReportActionID,
route.params?.transactionID,
Expand Down
Loading