Description
When an expense report has 50+ IOU report actions (oldest) followed by comments/other report actions (newest), the chat area below the transaction table appears empty. The comments and other non-IOU actions exist but are never loaded because pagination fails.
Root Cause
- For money request reports,
OpenReport explicitly uses ASC sort order (oldest first) — see Auth/auth/command/OpenReport.cpp line 278: reportActionSortOrder = ReportAction::SORT_ORDER_ASC
- The first page of 50 actions therefore contains the oldest actions: the CREATED action + IOU CREATE actions
MoneyRequestReportActionsList filters ALL of these out via isActionVisibleOnMoneyRequestReport():
- IOU actions with
type === CREATE or TRACK are filtered out (they are shown in the transaction table at the top instead)
- The CREATED report action is also filtered out by default
visibleReportActions ends up empty — the FlatList's data array has zero items
- The newer comment/non-IOU actions exist on subsequent pages but
onStartReached/onEndReached never fire because there are no data items to scroll through
loadNewerChats() (which would fetch the newer comments) is never triggered
The pagination system relies entirely on scroll events from the FlatList. When the FlatList's data array is empty (because all fetched actions were filtered out), no scroll events fire, breaking the pagination loop. There is no fallback mechanism to detect this state and trigger additional page fetches.
Key Files
Auth/auth/command/OpenReport.cpp — line 278: explicitly sets SORT_ORDER_ASC for money request reports
src/libs/MoneyRequestReportUtils.ts — isActionVisibleOnMoneyRequestReport() filters out IOU CREATE/TRACK actions and CREATED action (lines 34-53)
src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx — visibleReportActions filter (lines 320-345), FlatList with data={visibleReportActions} (line 862)
src/hooks/useLoadReportActions.ts — loadNewerChats() / loadOlderChats() are only triggered by scroll events (lines 90-151)
Auth/auth/lib/Report.cpp — page limit of 50 at line 616
Steps to Reproduce
- Create an expense report with 50+ individual expenses
- Add a few comments to the expense report (these will be chronologically newer than the IOU actions)
- Open the expense report in NewDot
- Observe that the transaction table shows expenses at the top, but the chat area below is completely empty — the comments are not loaded
- The comments exist on subsequent pages but pagination never triggers to fetch them
Expected Behavior
The chat area should show comments and other non-IOU report actions. The app should automatically paginate to load them even if the first page(s) contain only filtered-out IOU actions.
Actual Behavior
The chat area below the transaction table is completely empty. Comments and other report actions that exist on the report are not displayed.
Proposed Solution
Add a useEffect in MoneyRequestReportActionsList that detects when visibleReportActions is empty (or has too few items to fill the screen) while hasNewerActions is true, and automatically calls loadNewerChats(true) to fetch the next page. This should loop until visible actions appear or all pages are exhausted.
Platform
All platforms are affected since this is a data loading issue in shared React code.
Issue Owner
Current Issue Owner: @mallenexpensify
Description
When an expense report has 50+ IOU report actions (oldest) followed by comments/other report actions (newest), the chat area below the transaction table appears empty. The comments and other non-IOU actions exist but are never loaded because pagination fails.
Root Cause
OpenReportexplicitly uses ASC sort order (oldest first) — seeAuth/auth/command/OpenReport.cppline 278:reportActionSortOrder = ReportAction::SORT_ORDER_ASCMoneyRequestReportActionsListfilters ALL of these out viaisActionVisibleOnMoneyRequestReport():type === CREATEorTRACKare filtered out (they are shown in the transaction table at the top instead)visibleReportActionsends up empty — the FlatList'sdataarray has zero itemsonStartReached/onEndReachednever fire because there are no data items to scroll throughloadNewerChats()(which would fetch the newer comments) is never triggeredThe pagination system relies entirely on scroll events from the FlatList. When the FlatList's
dataarray is empty (because all fetched actions were filtered out), no scroll events fire, breaking the pagination loop. There is no fallback mechanism to detect this state and trigger additional page fetches.Key Files
Auth/auth/command/OpenReport.cpp— line 278: explicitly setsSORT_ORDER_ASCfor money request reportssrc/libs/MoneyRequestReportUtils.ts—isActionVisibleOnMoneyRequestReport()filters out IOU CREATE/TRACK actions and CREATED action (lines 34-53)src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx—visibleReportActionsfilter (lines 320-345), FlatList withdata={visibleReportActions}(line 862)src/hooks/useLoadReportActions.ts—loadNewerChats()/loadOlderChats()are only triggered by scroll events (lines 90-151)Auth/auth/lib/Report.cpp— page limit of 50 at line 616Steps to Reproduce
Expected Behavior
The chat area should show comments and other non-IOU report actions. The app should automatically paginate to load them even if the first page(s) contain only filtered-out IOU actions.
Actual Behavior
The chat area below the transaction table is completely empty. Comments and other report actions that exist on the report are not displayed.
Proposed Solution
Add a
useEffectinMoneyRequestReportActionsListthat detects whenvisibleReportActionsis empty (or has too few items to fill the screen) whilehasNewerActionsistrue, and automatically callsloadNewerChats(true)to fetch the next page. This should loop until visible actions appear or all pages are exhausted.Platform
All platforms are affected since this is a data loading issue in shared React code.
Issue Owner
Current Issue Owner: @mallenexpensify