Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[$250] Thread - Thread header glitches back to original link when sending a message #53603

Open
8 tasks
lanitochka17 opened this issue Dec 4, 2024 · 14 comments
Open
8 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Internal Requires API changes or must be handled by Expensify staff Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Dec 4, 2024

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
Bug6684636_1733341796913.ScreenRecording_12-05-2024_00-16-37_1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021866332306151200459
  • Upwork Job ID: 1866332306151200459
  • Last Price Increase: 2024-12-10
Issue OwnerCurrent Issue Owner: @ahmedGaber93
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 4, 2024
Copy link

melvin-bot bot commented Dec 4, 2024

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.

@truph01
Copy link
Contributor

truph01 commented Dec 4, 2024

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:

    parsedReportActionMessageCache[key] = textMessage;

    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:

App/src/libs/ReportUtils.ts

Lines 3829 to 3831 in 0e28aa4

if (cachedText !== undefined) {
return cachedText;
}

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:
    parsedReportActionMessageCache[key] = textMessage;

    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

@alexpensify
Copy link
Contributor

Adding to my testing list

@melvin-bot melvin-bot bot added the Overdue label Dec 9, 2024
@alexpensify alexpensify added the External Added to denote the issue can be worked on by a contributor label Dec 10, 2024
@melvin-bot melvin-bot bot changed the title Thread - Thread header glitches back to original link when sending a message [$250] Thread - Thread header glitches back to original link when sending a message Dec 10, 2024
Copy link

melvin-bot bot commented Dec 10, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 10, 2024
Copy link

melvin-bot bot commented Dec 10, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Dec 10, 2024
@alexpensify
Copy link
Contributor

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

@ahmedGaber93
Copy link
Contributor

Sorry for the delay, reviewing today.

@ahmedGaber93
Copy link
Contributor

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

@truph01
Copy link
Contributor

truph01 commented Dec 12, 2024

@ahmedGaber93 What do you think about my proposal above?

@ahmedGaber93
Copy link
Contributor

ahmedGaber93 commented Dec 12, 2024

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

@ahmedGaber93
Copy link
Contributor

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

@truph01
Copy link
Contributor

truph01 commented Dec 13, 2024

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

@ahmedGaber93
Copy link
Contributor

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

@alexpensify alexpensify added Weekly KSv2 Internal Requires API changes or must be handled by Expensify staff and removed Daily KSv2 Help Wanted Apply this label when an issue is open to proposals by contributors External Added to denote the issue can be worked on by a contributor labels Dec 15, 2024
@alexpensify
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Internal Requires API changes or must be handled by Expensify staff Weekly KSv2
Projects
Status: No status
Development

No branches or pull requests

4 participants