fix: Message/Task sent or created offline isn’t shown on the Reports page.#83133
Conversation
|
@hungvu193 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ac1a94f289
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…3-message-sent-offline-is-not-shown-in-reports-page
JmillsExpensify
left a comment
There was a problem hiding this comment.
All offline behavior aligns with product spec.
…in a shared utility
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
@hungvu193 I've applied the review suggestions and fixed the failing jest test. The prettier failing check is unexpected and being discussed here. You can continue the review and I'll post the follow up issues which I found while working on this PR. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b255b2b161
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
src/libs/actions/Report/index.ts
Outdated
|
|
||
| const snapshotDataToClear = { | ||
| [`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]: null, | ||
| [`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`]: null, |
There was a problem hiding this comment.
Preserve existing chat snapshot actions on add-comment failure
Setting data[reportActions_<reportID>] to null in the failure snapshot rollback removes the entire action map for that chat, not just the optimistic action(s) added in this request. If the chat already had actions in the canned Chats snapshot, a single failed send will drop all of them from Reports > Chats until a fresh Search API reload repopulates the snapshot.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
I think this is correct, why do we need to clear the ONYXKEYS.COLLECTION.REPORT}${reportID data here? If we sent a message unsuccessfully, we should remove that reportAction and the property that we added in optimisticReport only?
There was a problem hiding this comment.
We should remove the message (snapShot data) only when user clicks close button to remove the message.
Screen.Recording.2026-02-23.at.10.10.36.mov
There was a problem hiding this comment.
Will look into this suggestion tomorrow.
src/libs/actions/Task.ts
Outdated
| const snapshotDataToClear = { | ||
| [`${ONYXKEYS.COLLECTION.REPORT}${optimisticTaskReport.reportID}`]: null, | ||
| [`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${optimisticTaskReport.reportID}`]: null, | ||
| [`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`]: null, |
There was a problem hiding this comment.
Do not clear all parent chat actions on task-create failure
Rolling back task creation by writing null to data[reportActions_<parentReportID>] wipes every parent-chat action currently cached in the canned snapshot, including pre-existing messages unrelated to the failed task. In failure scenarios this causes the parent conversation to disappear or lose history in Reports > Chats until a full search refetch occurs.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Same here. We should only revert the property we added in optimisticTaskReport object, not the entire report object.
There was a problem hiding this comment.
Will look into this suggestion tomorrow.
There was a problem hiding this comment.
Have you had a chance to look at it yet?
There was a problem hiding this comment.
Sorted the message one, looking into tasks.
I struggled to create a failed task as Reports > Task immediately calls Search API which renders the error message page so I tweaked some params in the API to simulate failing task creation request.
There was a problem hiding this comment.
Message.mov
This is how messages should be disappear from Reports > Chats when the sending message API fails?
There was a problem hiding this comment.
For tasks,
Are you sure we should make it like the following?
Task.mp4
To implement (what I shared in the video), we need to make the following array empty:
Lines 196 to 209 in 24fd24e
Which isn't the change in this PR instead it is already existing part of the code.
Let me know your thoughts.
There was a problem hiding this comment.
I think that's correct behavior. This is also an edge that is good to handle 😄
There was a problem hiding this comment.
Added the removal of snapshot data when dismissing the error. I believe we don't need to optimize the snapshot data clearing more on API failure as the Search API will sync the data in Reports > Chats and Reports > Task.
Message
Message.mov
Task
Task.mov
There was a problem hiding this comment.
Thanks for handling it 🙏
…3-message-sent-offline-is-not-shown-in-reports-page
…3-message-sent-offline-is-not-shown-in-reports-page
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroidHybrid.movAndroid: mWeb ChromemChrome.moviOS: HybridAppios.moviOS: mWeb SafarimSafari.movMacOS: Chrome / SafariChrome.mov |
|
I wanna ask something here, please don't merge this on staging before that. cc: @inimaga |
|
Congrats, that's your 5th PR merged! 🎉 Do you know about the ContributorPlus role? It's an opportunity to earn more in the Expensify Open Source community. Keep up the great work - thanks! |
|
🚧 @inimaga has triggered a test Expensify/App build. You can view the workflow run here. |
@Uzaifm127 I unfortunately missed this message. If something needs changing, let's raise a mini-followup PR. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
There were no major changes required in this PR. I accidentally left Let me know whether should I raise a mini PR to remove those? Secondly, I found the following follow up issues when working on this PR (These issues aren't the regressions of this PR as they exist before but having the offline data in Reports > Chats and Reports > Task exposed these).
First issue is about editing the Task title offline which I felt, isn't the part of the OP as the OP is about to add messages in Reports > Chats. We can open a follow up issue for this. Second issue is about the infinite loading which seems totally different of what we are solving, we can also cover this in the same follow up issue for First issue. Here are the video of the issue: followup-issues.mp4Let me know what should we do now? cc: @hungvu193 |
|
🚀 Deployed to staging by https://github.com/inimaga in version: 9.3.28-0 🚀
|
|
🚀 Deployed to staging by https://github.com/inimaga in version: 9.3.30-0 🚀
|
|
@Uzaifm127 Thanks for the writeup and explanation. I've created an issue here to resolve these follow-up issues alongside the cleanups that need to be done. Would you be interested in working on this? As I'd rather you do than open it up externally. |
|
@inimaga Sure, for the following issue I already put the hard work on that:
Asked on that issue for assignment. |
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.3.30-3 🚀
|
Explanation of Change
This PR is fixing an issue in which the offline sent messages and offline created tasks aren't shown in Reports page (inside Reports > Chats and Reports > Task).
Fixed Issues
$ #82033
PROPOSAL: #82033 (comment)
Tests
Offline tests
Same as Tests
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android-native.mp4
Android: mWeb Chrome
Android-mWeb.mp4
iOS: Native
ios-native.mp4
iOS: mWeb Safari
ios-mWeb.mp4
MacOS: Chrome / Safari
macOS.mp4