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
[Due for payment 2026-03-12][$250] Chat - Message sent in offline is not shown in reports page #82033
Version Number: V9.3.16-4 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: N/A Email or phone of affected tester (no customers):dreamnitethedragon@gmail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Redminote 10S Android 13 App Component: Money Requests
Action Performed:
Launch app
Go to reports - expense ( select from Type dropdown)
Go offline
Add an expense (selecting 1:1 user)
Note expense added in offline is shown in reports page
Go online
Go to reports - chat ( select from Type dropdown)
Go offline
Send a message (selecting 1:1 user)
Note message sent in offline is not shown in reports page
Expected Result:
Message sent in offline must be shown in reports page.
Actual Result:
Message sent in offline is not shown in reports page like expense.
Note:
Similarly task created in offline is also not shown in reports page.
changed the title [-]Chat - Message sent in offline is not shown in reports page[/-][+][$250] Chat - Message sent in offline is not shown in reports page[/+]on Feb 10, 2026
Please re-state the problem that we are trying to solve in this issue.
When a user sends a message or creates a task while offline, the new item does not appear in the Reports (Search) page list. This occurs because the ONYXKEYS.COLLECTION.SNAPSHOT key, which drives the data for the Search page, is not being updated optimistically for these actions. The items only appear after the device goes online and the server responds.
Solution
Manually update the ONYXKEYS.COLLECTION.SNAPSHOT Onyx key with optimistic data when a user adds a comment or creates a task, similar to how it is currently handled for Expenses.
For Messages (Chats):
In src/libs/actions/Report/index.ts, inside the addActions function, we now retrieve the current search query. If the current search type is CHAT, we optimistically merge the new report and report actions into the current snapshot hash.
For Tasks:
In src/libs/actions/Task.ts, inside the createTaskAndNavigate function, we check if the current search type is CHAT or TASK. If so, we optimistically merge the new task report, the updated parent report, and the created report actions into the current snapshot hash.
This ensures that offline actions are immediately reflected in the UI, providing a consistent "offline-first" experience across all report types.
Changes
1. src/libs/actions/Report/index.ts
Updated addActions to include optimistic snapshot updates.
// ... importsimport{getCurrentSearchQueryJSON}from'@libs/SearchQueryUtils';// ... inside addActions functionconstcurrentSearchQueryJSON=getCurrentSearchQueryJSON();if(currentSearchQueryJSON?.type===CONST.SEARCH.DATA_TYPES.CHAT){// @ts-expect-error - will be solved in https://github.com/Expensify/App/issues/73830optimisticData.push({onyxMethod: Onyx.METHOD.MERGE,key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${currentSearchQueryJSON.hash}`,value: {data: {[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]: optimisticReport,[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`]: optimisticReportActions,},},});}// ...
2. src/libs/actions/Task.ts
Updated createTaskAndNavigate to include optimistic snapshot updates.
Please re-state the problem that we are trying to solve in this issue.
The message sent while offline must be shown on the Reports page when viewing Reports → Chat.
What is the root cause of that problem?
Chat search results on the Reports page come only from the search API snapshot stored in Onyx. When the user is offline, the search either does not run or returns stale data, so the snapshot never contains the newly created chat or the message. The UI only renders what is in that snapshot, so offline-created chats never appear.
RCA – Code that causes the issue:
SearchContext returns only snapshot data for Chat type (no merge with local Onyx).
currentSearchResults is built from the snapshot keyed by search hash. For non–to-do searches it returns the snapshot as-is. There is no merge of chat reports that exist in Onyx (e.g. created or updated offline) but are not in the snapshot.
// If viewing a to-do search, use live data from useTodos, otherwise return the snapshot data
// We do this so that we can show the counters for the to-do search results without visiting the specific to-do page, e.g. show `Approve [3]` while viewing the `Submit` to-do search.
const[snapshotSearchResults]=useOnyx(`${ONYXKEYS.COLLECTION.SNAPSHOT}${searchContextData.currentSearchHash}`,{canBeMissing: true});consttodoSearchResultsData=useTodos();// ... no useOnyx for REPORT or REPORT_ACTIONSconstcurrentSearchResults=useMemo((): SearchResults|undefined=>{if(shouldUseLiveData){// ... todo path}returnsnapshotSearchResults??undefined;// Chat type: only snapshot, no local merge},[shouldUseLiveData,currentSearchKey,todoSearchResultsData,snapshotSearchResults]);
So for Reports → Chat, currentSearchResults.data is only the snapshot. Any chat created or updated offline (and thus only in Onyx) is never included.
Chat list is built only from the data passed in (snapshot).
getReportActionsSections(data) iterates only over keys in data (report action entries, reports, etc.). If the offline chat’s report and report actions are not in data, they are never rendered.
for(constkeyindata){if(isReportActionEntry(key)){constreportActions=Object.values(data[key]);// ... only processes report actions that are already in `data`for(constreportActionofreportActions){constreport=data[`${ONYXKEYS.COLLECTION.REPORT}${reportAction.reportID}`]??{};// If report/actions for offline chat are not in `data`, they are never shown
So the list is strictly “what’s in data”. With Chat type, data is the snapshot only; offline chats are missing from the list.
Summary:
Reports → Chat uses only API snapshot data. Offline-created chats live only in Onyx and are never merged into the data passed to the list. Expenses work because expense flows already merge/optimistic-update the snapshot or use live Onyx data in other code paths.
What changes do you think we should make in order to solve the problem?
When the Reports search type is Chat, merge into the search results any local chat reports from Onyx that are not already in the snapshot. That way, chats created or updated offline (e.g. 1:1 with a sent message) appear in Reports → Chat without waiting for the next successful API search.
All changes are in one file:App/src/components/Search/SearchContext.tsx.
Change 1 – Imports: add isChatReport and isPolicyExpenseChat
// When viewing Chat search, merge in chat reports from Onyx that are not in the snapshot (e.g. messages sent offline) so they appear in the Reports page.constcurrentSearchResults=useMemo((): SearchResults|undefined=>{if(shouldUseLiveData){constliveData=todoSearchResultsData[currentSearchKeyaskeyoftypeoftodoSearchResultsData];constsearchInfo: SearchResultsInfo={
...(snapshotSearchResults?.search??defaultSearchInfo),count: liveData.metadata.count,total: liveData.metadata.total,currency: liveData.metadata.currency,};consthasResults=Object.keys(liveData.data).length>0;return{search: {...searchInfo,isLoading: false, hasResults},data: liveData.data,};}constsnapshot=snapshotSearchResults;if(!snapshot?.data||snapshot.search?.type!==CONST.SEARCH.DATA_TYPES.CHAT){returnsnapshot??undefined;}// Merge in chat reports from Onyx that are not in the search snapshot (e.g. 1:1 chats created or messages sent while offline)constsnapshotData=snapshot.dataasRecord<string,unknown>;constmergedData={...snapshotData};constreportKey=(reportID: string)=>`${ONYXKEYS.COLLECTION.REPORT}${reportID}`;constreportActionsKey=(reportID: string)=>`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`;for(constreportofObject.values(allReports??{})){if(!report?.reportID||!isChatReport(report)||report.parentReportID||isPolicyExpenseChat(report)){continue;}constrKey=reportKey(report.reportID);if(mergedData[rKey]!=null){continue;}constactions=allReportActions?.[reportActionsKey(report.reportID)];if(!actions||Object.keys(actions).length===0){continue;}mergedData[rKey]=report;mergedData[reportActionsKey(report.reportID)]=actions;}// Ensure personalDetailsList is present for display (e.g. "from" in chat list items)if(personalDetailsList&&!mergedData[ONYXKEYS.PERSONAL_DETAILS_LIST]){mergedData[ONYXKEYS.PERSONAL_DETAILS_LIST]=personalDetailsList;}elseif(personalDetailsList&&mergedData[ONYXKEYS.PERSONAL_DETAILS_LIST]){mergedData[ONYXKEYS.PERSONAL_DETAILS_LIST]={...(mergedData[ONYXKEYS.PERSONAL_DETAILS_LIST]asRecord<string,unknown>), ...personalDetailsList};}return{...snapshot,data: mergedData};},[shouldUseLiveData,currentSearchKey,todoSearchResultsData,snapshotSearchResults,allReports,allReportActions,personalDetailsList,]);
What alternative solutions did you explore? (Optional)
Re-run or adapt search when coming back online: Would require extra API calls and handling for “partial” offline results; merging from Onyx is simpler and keeps the list consistent as soon as the user views Reports → Chat.
Merge at getReportActionsSections / Search component level: Possible, but merging in SearchContext keeps a single source of truth for “current search results” and avoids passing allReports / allReportActions down into the Search UI layer.
Please re-state the problem that we are trying to solve in this issue.
A chat message sent while offline does not appear in the Reports list when filtering by Chat. Expenses created offline appear correctly, but offline-sent chat messages do not show up in the list.
What is the root cause of that problem?
In this flow, addComment → addActions builds optimistic child report actions and calls getOptimisticDataForAncestors, but this helper in src/libs/ReportUtils.ts assumes that updating only REPORT_ACTIONS is enough. This assumption is wrong because the Reports list depends on report-level fields like lastVisibleActionCreated. Since the optimistic REPORT merge is missing, the report metadata is not updated, and the offline message is not surfaced.
What changes do you think we should make in order to solve the problem?
State the single invariant you’re enforcing
When adding optimistic child actions, ancestor reports must receive atomic optimistic updates for both ancestor REPORT_ACTIONS and ancestor REPORT metadata so listing and sorting code sees the change immediately.
Point to the earliest incorrect assumption getOptimisticDataForAncestors assumed that updating only ${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${ancestorReportID} is enough for listing UIs. This is the earliest incorrect assumption.
Apply the smallest shared-layer fix
Modify getOptimisticDataForAncestors in src/libs/ReportUtils.ts to return both:
an Onyx MERGE for ${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${ancestorReportID}, and
an Onyx MERGE for ${ONYXKEYS.COLLECTION.REPORT}${ancestorReportID} setting lastVisibleActionCreated.
This keeps the fix in one shared helper used by all callers.
One file changed. One helper updated. Small additive change.
Edited function (exact code excerpt):
functiongetOptimisticDataForAncestors(ancestors: Ancestor[],lastVisibleActionCreated: string,type: string): Array<OnyxUpdate<typeofONYXKEYS.COLLECTION.REPORT_ACTIONS>>{letpreviousActionDeleted=false;// For each ancestor we need to update both:// 1) the ancestor's reportAction entry (child counts, etc)// 2) the ancestor's report metadata so list views that read report-level fields (eg. lastVisibleActionCreated)// return a flattened array of Onyx updates for both keys.returnancestors.flatMap(({report: ancestorReport,reportAction: ancestorReportAction},index)=>{constupdatedReportAction=updateOptimisticParentReportAction(ancestorReportAction,lastVisibleActionCreated,type,previousActionDeleted ? index+1 : undefined,);previousActionDeleted=isDeletedAction(ancestorReportAction)&&updatedReportAction.childVisibleActionCount===0;constreportActionUpdate: OnyxUpdate<typeofONYXKEYS.COLLECTION.REPORT_ACTIONS>={onyxMethod: Onyx.METHOD.MERGE,key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${ancestorReport.reportID}`,value: {[ancestorReportAction.reportActionID]: updatedReportAction,},};constreportUpdate: OnyxUpdate<typeofONYXKEYS.COLLECTION.REPORT>={onyxMethod: Onyx.METHOD.MERGE,key: `${ONYXKEYS.COLLECTION.REPORT}${ancestorReport.reportID}`,value: {// Update the ancestor report's lastVisibleActionCreated so list screens which rely on report-level// metadata will surface the optimistic change immediately while offline.lastVisibleActionCreated: lastVisibleActionCreated,},};return[reportActionUpdate,reportUpdate];});}
Note risk and ownership
Owner: Report and Actions shared utilities in src/libs/ReportUtils.ts.
Risk: Low. The change is additive and centralized. Revert is one file.
Teams to notify: Report and Actions, LHN and OptionsList owners.
Implementation note
No callers need changes. Callers already pass the output of getOptimisticDataForAncestors into optimisticData. API.prepareRequest applies this via Onyx.update, so adding the REPORT merge makes the change visible while offline.
What alternative solutions did you explore? (Optional)
📣 @Uzaifm127 You have been assigned to this job!
Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑💻
Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs!
Keep in mind: Code of Conduct | Contributing 📖
changed the title [-][$250] Chat - Message sent in offline is not shown in reports page[/-][+][Due for payment 2026-03-12][$250] Chat - Message sent in offline is not shown in reports page[/+]on Mar 11, 2026
Activity
melvin-bot commentedon Feb 10, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @hungvu193 (
External)melvin-bot commentedon Feb 10, 2026
Triggered auto assignment to @johncschuster (
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.[-]Chat - Message sent in offline is not shown in reports page[/-][+][$250] Chat - Message sent in offline is not shown in reports page[/+]melvin-bot commentedon Feb 10, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022021291443723323592
harjot96 commentedon Feb 10, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user sends a message or creates a task while offline, the new item does not appear in the Reports (Search) page list. This occurs because the
ONYXKEYS.COLLECTION.SNAPSHOTkey, which drives the data for the Search page, is not being updated optimistically for these actions. The items only appear after the device goes online and the server responds.Solution
Manually update the
ONYXKEYS.COLLECTION.SNAPSHOTOnyx key with optimistic data when a user adds a comment or creates a task, similar to how it is currently handled for Expenses.For Messages (Chats):
In
src/libs/actions/Report/index.ts, inside theaddActionsfunction, we now retrieve the current search query. If the current search type isCHAT, we optimistically merge the new report and report actions into the current snapshot hash.For Tasks:
In
src/libs/actions/Task.ts, inside thecreateTaskAndNavigatefunction, we check if the current search type isCHATorTASK. If so, we optimistically merge the new task report, the updated parent report, and the created report actions into the current snapshot hash.This ensures that offline actions are immediately reflected in the UI, providing a consistent "offline-first" experience across all report types.
Changes
1.
src/libs/actions/Report/index.tsUpdated
addActionsto include optimistic snapshot updates.2.
src/libs/actions/Task.tsUpdated
createTaskAndNavigateto include optimistic snapshot updates.abbasifaizan70 commentedon Feb 10, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
The message sent while offline must be shown on the Reports page when viewing Reports → Chat.
What is the root cause of that problem?
Chat search results on the Reports page come only from the search API snapshot stored in Onyx. When the user is offline, the search either does not run or returns stale data, so the snapshot never contains the newly created chat or the message. The UI only renders what is in that snapshot, so offline-created chats never appear.
RCA – Code that causes the issue:
SearchContext returns only snapshot data for Chat type (no merge with local Onyx).
currentSearchResultsis built from the snapshot keyed by search hash. For non–to-do searches it returns the snapshot as-is. There is no merge of chat reports that exist in Onyx (e.g. created or updated offline) but are not in the snapshot.App/src/components/Search/SearchContext.tsx
Lines 79 to 109 in 580c98f
Code in RCA (issue):
So for Reports → Chat,
currentSearchResults.datais only the snapshot. Any chat created or updated offline (and thus only in Onyx) is never included.Chat list is built only from the
datapassed in (snapshot).getReportActionsSections(data)iterates only over keys indata(report action entries, reports, etc.). If the offline chat’s report and report actions are not indata, they are never rendered.App/src/libs/SearchUIUtils.ts
Lines 1935 to 1971 in 580c98f
Code in RCA (issue):
So the list is strictly “what’s in
data”. With Chat type,datais the snapshot only; offline chats are missing from the list.Summary:
Reports → Chat uses only API snapshot data. Offline-created chats live only in Onyx and are never merged into the data passed to the list. Expenses work because expense flows already merge/optimistic-update the snapshot or use live Onyx data in other code paths.
What changes do you think we should make in order to solve the problem?
When the Reports search type is Chat, merge into the search results any local chat reports from Onyx that are not already in the snapshot. That way, chats created or updated offline (e.g. 1:1 with a sent message) appear in Reports → Chat without waiting for the next successful API search.
All changes are in one file:
App/src/components/Search/SearchContext.tsx.Change 1 – Imports: add
isChatReportandisPolicyExpenseChatApp/src/components/Search/SearchContext.tsx
Lines 7 to 8 in 580c98f
Old code:
New code:
Change 2 – Subscribe to Onyx REPORT, REPORT_ACTIONS, and PERSONAL_DETAILS_LIST
App/src/components/Search/SearchContext.tsx
Lines 79 to 80 in 580c98f
New code:
Change 3 – When type is Chat, merge local chat reports into snapshot data
App/src/components/Search/SearchContext.tsx
Lines 90 to 109 in 580c98f
New code:
What alternative solutions did you explore? (Optional)
getReportActionsSections/ Search component level: Possible, but merging inSearchContextkeeps a single source of truth for “current search results” and avoids passingallReports/allReportActionsdown into the Search UI layer.twinkle-react commentedon Feb 11, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
A chat message sent while offline does not appear in the Reports list when filtering by Chat. Expenses created offline appear correctly, but offline-sent chat messages do not show up in the list.
What is the root cause of that problem?
In this flow,
addComment → addActionsbuilds optimistic child report actions and callsgetOptimisticDataForAncestors, but this helper insrc/libs/ReportUtils.tsassumes that updating onlyREPORT_ACTIONSis enough. This assumption is wrong because the Reports list depends on report-level fields likelastVisibleActionCreated. Since the optimisticREPORTmerge is missing, the report metadata is not updated, and the offline message is not surfaced.What changes do you think we should make in order to solve the problem?
State the single invariant you’re enforcing
When adding optimistic child actions, ancestor reports must receive atomic optimistic updates for both ancestor
REPORT_ACTIONSand ancestorREPORTmetadata so listing and sorting code sees the change immediately.Point to the earliest incorrect assumption
getOptimisticDataForAncestorsassumed that updating only${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${ancestorReportID}is enough for listing UIs. This is the earliest incorrect assumption.Apply the smallest shared-layer fix
Modify
getOptimisticDataForAncestorsinsrc/libs/ReportUtils.tsto return both:${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${ancestorReportID}, and${ONYXKEYS.COLLECTION.REPORT}${ancestorReportID}settinglastVisibleActionCreated.This keeps the fix in one shared helper used by all callers.
Show the exact code delta and scope
Files changed
Function / logic modified
getOptimisticDataForAncestors(ancestors: Ancestor[], lastVisibleActionCreated: string, type: string)Scope size
Edited function (exact code excerpt):
Note risk and ownership
src/libs/ReportUtils.ts.Implementation note
No callers need changes. Callers already pass the output of
getOptimisticDataForAncestorsintooptimisticData.API.prepareRequestapplies this viaOnyx.update, so adding theREPORTmerge makes the change visible while offline.What alternative solutions did you explore? (Optional)
REPORT_ACTIONS.hungvu193 commentedon Feb 13, 2026
Reviewing shortly
16 remaining items
melvin-bot commentedon Feb 19, 2026
📣 @Uzaifm127 You have been assigned to this job!
Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑💻
Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs!
Keep in mind: Code of Conduct | Contributing 📖
Uzaifm127 commentedon Feb 19, 2026
I'll try to raise a PR within 48 hours.
hungvu193 commentedon Mar 11, 2026
The automation is failed. This issue will be due for payment on 12 Mar
[-][$250] Chat - Message sent in offline is not shown in reports page[/-][+][Due for payment 2026-03-12][$250] Chat - Message sent in offline is not shown in reports page[/+]johncschuster commentedon Mar 11, 2026
Payment Summary
johncschuster commentedon Mar 11, 2026
@hungvu193 does this one need regression test steps? If so, can you post them?
hungvu193 commentedon Mar 12, 2026
Regression test:
Do we 👍 or 👎 ?
twisterdotcom commentedon Mar 12, 2026
@hungvu193 has submitted payment for this report on ND here.
SO: https://stackoverflowteams.com/c/expensify/questions/7582
Zapier Logs
Run ID: 00040eee-1c97-a19c-60b0-3f6f716b40a4Uzaifm127 commentedon Mar 12, 2026
@johncschuster Accepted the offer and requested the payment on upwork.
johncschuster commentedon Mar 13, 2026
Paid! All done here!