You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] Reports - List does not load more messages when scrolled to the end of list on Reports > Chats #72521
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
changed the title [-]Reports - List does not load more messages when scrolled to the end of list on Reports > Cha[/-][+]Reports - List does not load more messages when scrolled to the end of list on Reports > Chats[/+]on Oct 14, 2025
This condition relies on data.length, but data.length only reflects the number of items currently displayed—not the number of items on the server. That means if some items aren’t actually rendered, the condition will always evaluate as true. As a result, no additional data will ever be fetched.
What changes do you think we should make in order to solve the problem?
We already have the value searchResults?.search?.hasMoreResults, so the condition offset > data.length - CONST.SEARCH.RESULTS_PAGE_SIZE is no longer necessary. We can remove it.
Please re-state the problem that we are trying to solve in this issue.
Chat page doesn't load more when reaches bottom.
What is the root cause of that problem?
This happen because the offset is bigger than the data length (minus 50). This is so that the search won't be triggered if the offset is already increased but the new data is not fetched yet.
Each time we load a data, it will be 50 items maximum. However, the data.length contains the filtered data length. So, we receive 50 data from the BE, but then we filtered it out on the FE.
So, offset > data.length - CONST.SEARCH.RESULTS_PAGE_SIZE will always evaluate to true because data.length - 50 will be negative.
What changes do you think we should make in order to solve the problem?
To fix it, we need to get the original, unfiltered data length. We can update getReportActionsSections (and others) to also return the total length. For example, in getReportActionsSections,
let n = 0;
for (const key in data) {
if (isReportActionEntry(key)) {
const reportActions = Object.values(data[key]);
n += reportActions.length;
...
}
return [reportActionItems, n];
Then, in Search/index.ts, use that length instead of data.length.
changed the title [-]Reports - List does not load more messages when scrolled to the end of list on Reports > Chats[/-][+][$250] Reports - List does not load more messages when scrolled to the end of list on Reports > Chats[/+]on Oct 14, 2025
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Precondition:
Have an account with 50+ report actions (messages/expenses)
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Activity
melvin-bot commentedon Oct 14, 2025
Triggered auto assignment to @mallenexpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.[-]Reports - List does not load more messages when scrolled to the end of list on Reports > Cha[/-][+]Reports - List does not load more messages when scrolled to the end of list on Reports > Chats[/+]dmkt9 commentedon Oct 14, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
The list does not load more messages when scrolled to the end of list.
What is the root cause of that problem?
When scrolling to the end of the list, the
fetchMoreResultsfunction is triggered to fetch more data.App/src/components/Search/index.tsx
Line 750 in 89c45c9
However, inside
fetchMoreResults, the conditionoffset > data.length - CONST.SEARCH.RESULTS_PAGE_SIZEis used for checking:App/src/components/Search/index.tsx
Lines 752 to 754 in 89c45c9
This condition relies on
data.length, butdata.lengthonly reflects the number of items currently displayed—not the number of items on the server. That means if some items aren’t actually rendered, the condition will always evaluate as true. As a result, no additional data will ever be fetched.What changes do you think we should make in order to solve the problem?
We already have the value
searchResults?.search?.hasMoreResults, so the conditionoffset > data.length - CONST.SEARCH.RESULTS_PAGE_SIZEis no longer necessary. We can remove it.bernhardoj commentedon Oct 14, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Chat page doesn't load more when reaches bottom.
What is the root cause of that problem?
This happen because the
offsetis bigger than the data length (minus 50). This is so that the search won't be triggered if the offset is already increased but the new data is not fetched yet.App/src/components/Search/index.tsx
Lines 803 to 809 in 276a46a
Each time we load a data, it will be 50 items maximum. However, the
data.lengthcontains the filtered data length. So, we receive 50 data from the BE, but then we filtered it out on the FE.App/src/libs/SearchUIUtils.ts
Lines 1316 to 1351 in 276a46a
So,
offset > data.length - CONST.SEARCH.RESULTS_PAGE_SIZEwill always evaluate to true because data.length - 50 will be negative.What changes do you think we should make in order to solve the problem?
To fix it, we need to get the original, unfiltered data length. We can update
getReportActionsSections(and others) to also return the total length. For example, ingetReportActionsSections,Then, in
Search/index.ts, use that length instead ofdata.length.App/src/components/Search/index.tsx
Lines 411 to 425 in 276a46a
App/src/components/Search/index.tsx
Line 805 in 276a46a
[-]Reports - List does not load more messages when scrolled to the end of list on Reports > Chats[/-][+][$250] Reports - List does not load more messages when scrolled to the end of list on Reports > Chats[/+]melvin-bot commentedon Oct 14, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021978213110993190254
melvin-bot commentedon Oct 14, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @FitseTLT (
External)mallenexpensify commentedon Oct 14, 2025
Was able to reproduce. @FitseTLT 👀 on the proposals above. Thx
2025-10-14_14-34-37.mp4
40 remaining items
melvin-bot commentedon Dec 16, 2025
This issue has not been updated in over 15 days. @flodnv, @mallenexpensify, @FitseTLT, @bernhardoj eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
bernhardoj commentedon Dec 16, 2025
@mallenexpensify looks like the automation failed here. It was deployed to prod 2 weeks ago.
FitseTLT commentedon Dec 16, 2025
BugZero Checklist:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: https://github.com/Expensify/App/pull/70211/changes#r2623655608
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-dc51-a2fc-66a4-1a2bd2540234FitseTLT commentedon Dec 16, 2025
Here is the checklist @mallenexpensify
mallenexpensify commentedon Dec 16, 2025
Payment Summary
Contributor: @bernhardoj due $250 via NewDot
Contributor+: @FitseTLT paid $250 via Upwork
Test case created ^
Thx!
bernhardoj commentedon Dec 17, 2025
Requested in ND.
garrettmknight commentedon Dec 29, 2025
$250 approved for @bernhardoj