App icon indicating copy to clipboard operation
App copied to clipboard

Thread - Thread header glitches back to original link when sending a message

Open lanitochka17 opened this issue 1 year ago • 3 comments

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:

  1. Open HybridApp
  2. Navigate to any report
  3. Send a message to google.com
  4. Create a thread with the message from step 3
  5. Send the message in the thread
  6. Change the parent message to test.com
  7. 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

View all open jobs on GitHub

lanitochka17 avatar Dec 04 '24 21:12 lanitochka17

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.

melvin-bot[bot] avatar Dec 04 '24 21:12 melvin-bot[bot]

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 lastModified data is t1. 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#L3857 P_parent_t1: "parent".

  • Then, update the message "parent" to "parent updated". Now its lastModified data is t2. Now this data is stored to cache P_parent_t2: "parent".

  • The bug appears when why open report C and send a new message "child 2". BE sets the lastModified to t1. 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 lastModified to t1.
  • Make sure parseReportActionHtmlToText function returns correct report action text.
  • Update the lastModified to t2 and the report action text.
  • Make sure parseReportActionHtmlToText function returns correct report action text.

What alternative solutions did you explore? (Optional)

  • NA

truph01 avatar Dec 04 '24 23:12 truph01

Adding to my testing list

alexpensify avatar Dec 06 '24 23:12 alexpensify

Job added to Upwork: https://www.upwork.com/jobs/~021866332306151200459

melvin-bot[bot] avatar Dec 10 '24 04:12 melvin-bot[bot]

Triggered auto assignment to Contributor-plus team member for initial proposal review - @ahmedGaber93 (External)

melvin-bot[bot] avatar Dec 10 '24 04:12 melvin-bot[bot]

@ahmedGaber93 - Can you please review and confirm if one of these proposals will fix the issue? Thanks!

alexpensify avatar Dec 10 '24 04:12 alexpensify

Sorry for the delay, reviewing today.

ahmedGaber93 avatar Dec 11 '24 19:12 ahmedGaber93

It looks like the contributor has deleted his proposal. Asking for proposals on slack

ahmedGaber93 avatar Dec 12 '24 14:12 ahmedGaber93

@ahmedGaber93 What do you think about my proposal above?

truph01 avatar Dec 12 '24 19:12 truph01

Oh, sorry, I didn't see it. Checking...

ahmedGaber93 avatar Dec 12 '24 19:12 ahmedGaber93

@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

  1. open any report and add comment ✅ API AddComment return lastModified as "2024-12-12 21:58:11.912" (initial date)
  2. click replay in thread, then update the comment ✅ API UpdateComment return lastModified as "2024-12-12 21:59:04.638" (updated date)
  3. add new message in the thread ❌ API AddComment return lastModified as "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 avatar Dec 12 '24 22:12 ahmedGaber93

@ahmedGaber93 Thanks. Can you tag the internal team here to see their final decision?

truph01 avatar Dec 13 '24 02:12 truph01

@alexpensify This a BE issue, and should be internal.

ahmedGaber93 avatar Dec 13 '24 13:12 ahmedGaber93

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 avatar Dec 15 '24 04:12 alexpensify

@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!

melvin-bot[bot] avatar Dec 18 '24 09:12 melvin-bot[bot]

https://github.com/Expensify/App/issues/53603#issuecomment-2543442070

ahmedGaber93 avatar Dec 18 '24 09:12 ahmedGaber93

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.

alexpensify avatar Dec 24 '24 06:12 alexpensify

Hot Pick

alexpensify avatar Dec 30 '24 18:12 alexpensify

Weekly Update: Hot Pick

alexpensify avatar Jan 09 '25 00:01 alexpensify

@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.

truph01 avatar Jan 20 '25 04:01 truph01

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.

alexpensify avatar Jan 20 '25 07:01 alexpensify

I had to step away today, I'll work on the discussion when I'm back.

alexpensify avatar Jan 29 '25 00:01 alexpensify

Still on the radar

alexpensify avatar Feb 07 '25 01:02 alexpensify

@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 avatar Feb 19 '25 02:02 alexpensify

@alexpensify Yes, I still think so.

ahmedGaber93 avatar Feb 19 '25 04:02 ahmedGaber93

Ok, thanks for confirming.

alexpensify avatar Feb 28 '25 00:02 alexpensify

🚨 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.

alexpensify avatar Mar 05 '25 16:03 alexpensify

Still catching up

alexpensify avatar Mar 14 '25 23:03 alexpensify

No update

alexpensify avatar Mar 25 '25 01:03 alexpensify

🚨 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!

alexpensify avatar Mar 28 '25 21:03 alexpensify