Thread - Thread header glitches back to original link when sending a message
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.71-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5299636 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause - Internal Team
Action Performed:
- Open HybridApp
- Navigate to any report
- Send a message to google.com
- Create a thread with the message from step 3
- Send the message in the thread
- Change the parent message to test.com
- Send the message in the thread
Expected Result:
The thread header should not change when a message is sent
Actual Result:
Thread header glitches back to original link when sending a message
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
- [ ] Android: Standalone
- [ ] Android: HybridApp
- [ ] Android: mWeb Chrome
- [ ] iOS: Standalone
- [ ] iOS: HybridApp
- [ ] iOS: mWeb Safari
- [ ] MacOS: Chrome / Safari
- [ ] MacOS: Desktop
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/user-attachments/assets/88020264-b79d-4a58-b867-a9ff1ce8affa
Triggered auto assignment to @alexpensify (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.
Proposal
Please re-state the problem that we are trying to solve in this issue.
- Thread header glitches back to original link when sending a message
What is the root cause of that problem?
-
Assume we send a message "parent" in report P and its
lastModifieddata ist1. Then we create a thread (named C) with that message by sending any message such as "child 1". Now the thread header displays "parent" and this data is stored to cache via: https://github.com/Expensify/App/blob/0e28aa4d7ab0e5ba4d2b050c47dc78b35a45992f/src/libs/ReportUtils.ts#L3857P_parent_t1: "parent". -
Then, update the message "parent" to "parent updated". Now its
lastModifieddata ist2. Now this data is stored to cacheP_parent_t2: "parent". -
The bug appears when why open report C and send a new message "child 2". BE sets the
lastModifiedtot1. As a result, when getting the report action text, logic:
https://github.com/Expensify/App/blob/0e28aa4d7ab0e5ba4d2b050c47dc78b35a45992f/src/libs/ReportUtils.ts#L3829-L3831
is true because the value of P_parent_t1 key is defined, parent, so the stale report action text is displayed.
What changes do you think we should make in order to solve the problem?
- Before we add a cache value to the cache storage in: https://github.com/Expensify/App/blob/0e28aa4d7ab0e5ba4d2b050c47dc78b35a45992f/src/libs/ReportUtils.ts#L3857 we should clear all the related outdated data by using:
const prefix = `${reportID}_${reportAction.reportActionID}_`;
Object.keys(parsedReportActionMessageCache).forEach((key) => {
if (key.startsWith(prefix)) {
delete parsedReportActionMessageCache[key];
}
});
- It will make sure with any report action, we only store one key-value pair data related to it. And BE can consider fixing my mentioned issue as well.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
- Mock the report action data. Set its
lastModifiedtot1. - Make sure
parseReportActionHtmlToTextfunction returns correct report action text. - Update the
lastModifiedtot2and the report action text. - Make sure
parseReportActionHtmlToTextfunction returns correct report action text.
What alternative solutions did you explore? (Optional)
- NA
Adding to my testing list
Job added to Upwork: https://www.upwork.com/jobs/~021866332306151200459
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ahmedGaber93 (External)
@ahmedGaber93 - Can you please review and confirm if one of these proposals will fix the issue? Thanks!
Sorry for the delay, reviewing today.
It looks like the contributor has deleted his proposal. Asking for proposals on slack
@ahmedGaber93 What do you think about my proposal above?
Oh, sorry, I didn't see it. Checking...
@truph01 Your RCA seem correct, add comment on thread always return the parent message lastModified with the initial date not the last modified date.
Here, steps to reproduce the issue and catch the BE response
- open any report and add comment
✅ API
AddCommentreturnlastModifiedas"2024-12-12 21:58:11.912"(initial date) - click replay in thread, then update the comment
✅ API
UpdateCommentreturnlastModifiedas"2024-12-12 21:59:04.638"(updated date) - add new message in the thread
❌ API
AddCommentreturnlastModifiedas"2024-12-12 21:58:11.912"(initial date) for the parent comment (that added in step 1). It should return the updated date.
Thanks for your investigation, But I think the BE fix should be enough to fix this, if step 3 return with the correct lastModified like step 2 the issue will be fixed.
Plus, I think your solution will clear all reportAction cache, not only the outdated, maybe we can think on this if BE not fix it, but right now I think the BE fix should be enough.
@ahmedGaber93 Thanks. Can you tag the internal team here to see their final decision?
@alexpensify This a BE issue, and should be internal.
Heads up, I will be offline until Wednesday, December 18, 2024, and will not actively watch over this GitHub during that period.
If this GitHub requires an urgent update, please ask for help in the #expensify-open-source Slack Room. If the inquiry can wait, I'll review it when I return online.
Moving to Weekly, for now, I'll start asking for BE help when I'm back online.
@alexpensify @ahmedGaber93 this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
https://github.com/Expensify/App/issues/53603#issuecomment-2543442070
There is no update yet. I didn't get to it before the Holiday break. I'll try to review this week, but I am working limited hours.
Hot Pick
Weekly Update: Hot Pick
@alexpensify This issue can be addressed on the FE side as well. If the BE team is currently overloaded or doesn't prioritize it, we can proceed with a solution on the FE side for now.
When I'm back online, I'll review with the team if we want to move forward with the FE update without the BE update.
I had to step away today, I'll work on the discussion when I'm back.
Still on the radar
@ahmedGaber93 preparing the discussion points. Do you still agree with your findings here:
Thanks for your investigation, But I think the BE fix should be enough to fix this, if step 3 return with the correct lastModified like step 2 the issue will be fixed.
Plus, I think your solution will clear all reportAction cache, not only the outdated, maybe we can think on this if BE not fix it, but right now I think the BE fix should be enough.
@alexpensify Yes, I still think so.
Ok, thanks for confirming.
🚨 Heads up! I'll be offline until Wednesday, March 12, 2025, and won’t be actively monitoring this GitHub during that time.
If this GitHub requires an urgent update, please reapply the bug label or reach out in the #expensify-open-source Slack room for help. Otherwise, I'll pick things up when I'm back online. Thanks!
Update: I'll work on the discussion when I'm back online.
Still catching up
No update
🚨 Heads up! I'll be offline until Monday, April 7, 2025, and won’t be actively monitoring this GitHub during that time.
If this GitHub requires an urgent update, please reapply the bug label or reach out in the #expensify-open-source Slack room for help. Otherwise, I'll pick things up when I'm back online. Thanks!