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✅ Changes either increased or maintained existing code coverage, great job!
|
|
@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".
|
|
||
| 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 👍 / 👎.
| 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 👍 / 👎.
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