Repository navigation
fix: Thread-Infinite Loading Occurs When Replying to a Deleted Parent Message - #62245
Conversation
|
@shubham1206agra 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] |
e76e66d to
d30865b
Compare
|
Hi @francoisl |
|
Hi @shubham1206agra Can you give me some feedback related to PR? Seems like all checks passed |
There was a problem hiding this comment.
@djordjemitrovic00 I believe isDeletedParentAction condition should be used first, then the additional condition.
There was a problem hiding this comment.
Now this comment is fixed and I answered to another one you posted, can you check? @shubham1206agra
There was a problem hiding this comment.
@djordjemitrovic00 Can you explain why do we need that?
There was a problem hiding this comment.
This function is used to display first message on thread and if we don't have any replies, it will show the message as "edited" instead of deleted message
If we dont do this, it will display latest message as blank message - no text at all with included (edited) flag, because "text" property gets blank after message is deleted. NOTE: This only occurs if we try to reply to thread, which gets deleted by the way and no text has been sent.
This way we won't show it blank, but we will check if original message has "deleted" flag and if it has (and IsDeletedParentAction is initially false) then it will mark it as deleted and show "Deleted Message" instead
3f9fa8e to
05adca3
Compare
|
@shubham1206agra @francoisl Can you, please, review this? No answer or update from you for a whole week, can you please provide me informations on what are we waiting for? |
|
@djordjemitrovic00 I am really sorry. Can you resolve the conflicts and I can do the review right now? |
|
Hey @shubham1206agra Thanks for fast reply |
There was a problem hiding this comment.
@djordjemitrovic00 What case does this condition cover?
There was a problem hiding this comment.
@shubham1206agra
I can confirm this later, but I’m fairly certain the issue occurs when we try to retrieve the name from the sidebar (which, as shown in the videos, is the message in the thread). If the message gets deleted in the meantime, the name shouldn't remain as the original text — it should display 'Deleted message' instead. So, we shouldn't rely on the attributes in this case.
There was a problem hiding this comment.
These are derived attributes, so they should be recalculated.
There was a problem hiding this comment.
Well, they are not recalculated until we send message I think (also I can confirm later this), but they are not recalculated automatically when we only receive message and not do any additional action(like clicking somewhere or sending message), is that something we should handle on our side? I can take a look after if needed
There was a problem hiding this comment.
Well, they are not recalculated until we send message I think
Not sure what you mean by this.
There was a problem hiding this comment.
When we attempt to send a message in a thread, and the original message that started the thread is deleted in the meantime, the message shown in the sidebar still displays the original thread text instead of showing “Deleted message., and after we send the message, the thread in the sidebar updates to “Deleted message” if we're relying on derived attributes. However, if we’re not using derived attributes, the thread updates to “Deleted message” immediately upon deletion of the original message.
There was a problem hiding this comment.
There's some bug in your PR if this is what is happening.
There was a problem hiding this comment.
Since on main, I can see the title changing immediately
There was a problem hiding this comment.
I just pulled and checked, seems like in meanwhile this was fixed. This wasn't happening before, so I'll delete this condition. Thanks for assistance! @shubham1206agra
6dd9d52 to
f1fc925
Compare
|
Hey @shubham1206agra can you check again, please? |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2025-06-16.at.9.44.32.PM.movAndroid: mWeb ChromeScreen.Recording.2025-06-16.at.9.31.43.PM.moviOS: HybridAppScreen.Recording.2025-06-16.at.9.41.05.PM.moviOS: mWeb SafariScreen.Recording.2025-06-16.at.9.29.01.PM.movMacOS: Chrome / SafariScreen.Recording.2025-06-16.at.9.17.29.PM.movMacOS: DesktopScreen.Recording.2025-06-16.at.9.36.14.PM.mov |
|
Thanks for putting reviewer checklist |
|
@djordjemitrovic00 Just merge main |
Co-authored-by: Shubham Agrawal <58412969+shubham1206agra@users.noreply.github.com>
f1fc925 to
5016af1
Compare
|
I just did @shubham1206agra |
shubham1206agra
left a comment
There was a problem hiding this comment.
Good work on your first PR.
|
Hey @francoisl can you take a look whenever you have time? |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/francoisl in version: 9.1.69-0 🚀
|
|
🚧 @lakchote has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/francoisl in version: 9.1.69-0 🚀
|
|
🚀 Deployed to staging by https://github.com/francoisl in version: 9.1.69-0 🚀
|
Discussing the next steps here |
|
🚀 Deployed to production by https://github.com/lakchote in version: 9.1.69-3 🚀
|
Explanation of Change
Previously, we only checked whether the isDeletedParentAction flag was set to true to determine if a chat thread was deleted. However, we should introduce a utility function called isChatThreadDeleted in ReportUtils.ts that also checks whether the deleted property is null. If deleted is not null, we can treat the thread as deleted.
In the sidebar, "Deleted message" needs to be displayed instead of "Hidden" or empty message. In SidebarUtils.ts, this is handled through the reportName variable, which uses the getReportName function that now relies on our new isChatThreadDeleted function.
We can invoke the getReportAction function, providing report.parentReportActionID as the report action ID to retrieve the parent report action. From the parent report action, we can then extract the message and check for the presence of the deleted or isDeletedParentAction flags.
Additionally, when sending a message to a deleted thread, both the deleted and isDeletedParentAction flags may be missing from the message itself. Nevertheless, these flags are still available within reportAction.originalMessage. Consequently, we have also implemented a check for their presence in the originalMessage.
There is a useful function, IsDeletedMessage, located in ReportActionUtils.ts. By modifying it to check both the deleted and isDeletedParentAction flags on both the message and the originalMessage, we can reliably determine whether a message has actually been deleted. We can then reuse this improved function within the new isChatThreadDeleted function.
Furthermore, because a sent message is displayed as edited rather than deleted, we must adjust the way we retrieve message fragments. Specifically, a deleted chat thread scenario is identified when there is only a single message present in the message property. Therefore, an additional check for this condition has been incorporated when retrieving chat fragments within the getReportActionMessageFragments function.
With this approach, the HeaderView.tsx component will correctly display the title "Deleted message" instead of showing a loading skeleton.
Fixed Issues
$ #59392
$ PROPOSAL: #59392 (comment)
Tests
I checked tests that are related to those enhancements, and no tests were failing.
Created new unit tests for functions I changed. There was no tests for function IsMessageDeleted so I added tests for whole function.
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
We need 2 application instances and 2 users to test this.
User A initiate a new chat, and provide User B’s email address.
Send a message to User B in the direct conversation.
Sign in with User B to access the message thread.
Return to User A, locate the sent message, right-click on it, remove it.
Switch back to User B and post a reply in the same thread.
Observe the following issues:
The thread header gets stuck in a perpetual loading state. (Shouldn't happen)
The message appears to have been edited rather than deleted. (Should be deleted)
In the sidebar, the conversation is marked as “Hidden” instead of showing as a “Deleted” message. (should be deleted)
Verify that no errors appear in the JS console
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))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.app.mp4
Android: mWeb Chrome
android.chrome.mp4
iOS: Native
ios.app.mp4
iOS: mWeb Safari
ios.chrome.mp4
MacOS: Chrome / Safari
mac.safari.mp4
MacOS: Desktop
mac.app.mp4