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

[HOLD for payment 2023-08-10] [$1000] Parent Message of thread chat on LHN doesn't updated when the parent message is updated #23424

Closed
1 of 6 tasks
kavimuru opened this issue Jul 23, 2023 · 26 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@kavimuru
Copy link

kavimuru commented Jul 23, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Go to new chat
  2. Send New message
  3. Go to the thread chat of the above message
  4. Send new message on the thread chat
  5. Update the parent message
  6. See title of thread chat on LHN

Expected Result:

Parent Message of thread chat on LHN should be updated

Actual Result:

Parent Message of thread chat on LHN doesn't updated

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.44-0
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

Screen.Recording.2023-07-22.at.17.04.50.mov
Recording.1321.mp4

Expensify/Expensify Issue URL:
Issue reported by: @dukenv0307
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1690020315164019

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~016848c21d8e7b7eeb
  • Upwork Job ID: 1683964849932365824
  • 2023-07-25
  • Automatic offers:
    • dukenv0307 | Contributor | 25796886
    • dukenv0307 | Reporter | 25796887
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 23, 2023

Triggered auto assignment to @tjferriss (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jul 23, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@samh-nl
Copy link
Contributor

samh-nl commented Jul 23, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

When editing the parent message of a thread, the LHN item title does not update.

What is the root cause of that problem?

The LHN menu item uses an useMemo hook to determine when it should be updated.

const optionItem = useMemo(() => {
// Note: ideally we'd have this as a dependent selector in onyx!
const item = SidebarUtils.getOptionData(fullReport, personalDetails, preferredLocale, policy);
if (deepEqual(item, optionItemRef.current)) {
return optionItemRef.current;
}
optionItemRef.current = item;
return item;
}, [fullReport, personalDetails, preferredLocale, policy]);

In the case of a thread, the title (report name) is derived using ReportUtils.getReportName, however this is not added as a dependency of useMemo.

Additionally, the component as a whole is also wrapped in React.memo, preventing a re-render:

export default React.memo(

What changes do you think we should make in order to solve the problem?

We should add the report name as a dependency of the useMemo hook, which can be determined using ReportUtils.getReportName. Additionally, we should update the React.memo to allow re-rendering in this circumstance.

What alternative solutions did you explore? (Optional)

Alternatively, we can add a different field to the report, such as the last modified date (e.g. parentLastModified) or the message of the parent, similar to how policy names are stored in the report This will ensure report changes, therefore causing a new render.

The advantage of this approach is that it will use the existing dependencies.

@dukenv0307
Copy link
Contributor

dukenv0307 commented Jul 24, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Parent Message of thread chat on LHN doesn't updated when the parent message is updated

What is the root cause of that problem?

When deleting the parent message of thread, we don't have any update on the report field of that thread report

const optionItem = useMemo(() => {

So that optionItem in here is not rendered again

What changes do you think we should make in order to solve the problem?

We can subscribe parentReportAction of the thread and we will get option item again if parentReportAction change
To do that

  1. We need to get reportActions of report
withOnyx({
            parentReportActions: {
                key: (props) => ONYXKEYS.COLLECTION.REPORT_ACTIONS + props.fullReport.parentReportID,
                canEvict: false
        }})
  1. Get ParentReportAction
 const parentReportAction = parentReportActions[fullReport.parentReportActionID]
  1. Add parentReportAction to dependency of useEffect
    }, [fullReport, personalDetails, preferredLocale, policy, parentReportAction]);

What alternative solutions did you explore? (Optional)

We should introduce new field called updateReportInLHN. When updating the parent message of child thread we should add updateReportInLHN: true to the child report field. So the child report field is changed and the LHN is updated
We just do the same thing with policyName on report field on ONYX like we did in this PR

@melvin-bot melvin-bot bot added the Overdue label Jul 25, 2023
@tjferriss tjferriss added the External Added to denote the issue can be worked on by a contributor label Jul 25, 2023
@melvin-bot melvin-bot bot changed the title Parent Message of thread chat on LHN doesn't updated when the parent message is updated [$1000] Parent Message of thread chat on LHN doesn't updated when the parent message is updated Jul 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

Triggered auto assignment to @mallenexpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

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

@tjferriss
Copy link
Contributor

Overdue no more, Melvin. Adding External label.

@melvin-bot melvin-bot bot removed the Overdue label Jul 25, 2023
@parasharrajat
Copy link
Member

Ok, this is a tricky one. Both proposals are correct. But @dukenv0307's proposal is more elegant.

@dukenv0307 Is there a way to listen for only one action instead of the whole collection? May be using selector.

🎀 👀 🎀 C+ reviewed

@melvin-bot
Copy link

melvin-bot bot commented Jul 26, 2023

Triggered auto assignment to @puneetlath, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 27, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 27, 2023

📣 @parasharrajat Please request via NewDot manual requests for the Reviewer role ($1000)

@melvin-bot
Copy link

melvin-bot bot commented Jul 27, 2023

📣 @dukenv0307 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot
Copy link

melvin-bot bot commented Jul 27, 2023

📣 @dukenv0307 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@puneetlath puneetlath added Weekly KSv2 and removed Daily KSv2 labels Jul 27, 2023
@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Jul 28, 2023
@dukenv0307
Copy link
Contributor

@parasharrajat The PR is ready for review.

@melvin-bot
Copy link

melvin-bot bot commented Jul 31, 2023

🎯 ⚡️ Woah @parasharrajat / @dukenv0307, great job pushing this forwards! ⚡️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @dukenv0307 got assigned: 2023-07-27 22:05:49 Z
  • when the PR got merged: 2023-07-31 18:44:38 UTC

On to the next one 🚀

@tjferriss
Copy link
Contributor

PR is merged but held on QA #23777 (comment)

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Aug 3, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Parent Message of thread chat on LHN doesn't updated when the parent message is updated [HOLD for payment 2023-08-10] [$1000] Parent Message of thread chat on LHN doesn't updated when the parent message is updated Aug 3, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 3, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 3, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot
Copy link

melvin-bot bot commented Aug 3, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.49-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-08-10. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

For reference, here are some details about the assignees on this issue:

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Aug 3, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@parasharrajat] The PR that introduced the bug has been identified. Link to the PR:
  • [@parasharrajat] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@parasharrajat] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@parasharrajat] Determine if we should create a regression test for this bug.
  • [@parasharrajat] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@puneetlath / @tjferriss / @mallenexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@tjferriss
Copy link
Contributor

Payment comment has been updated with contributors and amounts #23424 (comment)

@parasharrajat can you get started on the checklist when you have a chance?

@tjferriss
Copy link
Contributor

All set for payment barring regression. @parasharrajat can you grab the checklist when you have a minute?

@parasharrajat
Copy link
Member

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

Regression Test Steps

  1. Go to the new chat.
  2. Send New Message
  3. Create a the thread chat for the above message
  4. Send a new message on the thread chat.
  5. Update the parent message on the thread.
  6. Verify that the title of the thread chat on LHN is updated correctly

Do you agree 👍 or 👎 ?

@parasharrajat
Copy link
Member

Payment requested.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Aug 9, 2023
@tjferriss
Copy link
Contributor

@dukenv0307 has been paid via Upworks. Regression test has been submitted https://github.com/Expensify/Expensify/issues/307290

@parasharrajat did you request payment via NewDot?

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Aug 11, 2023
@parasharrajat
Copy link
Member

@tjferriss Yes.

@JmillsExpensify
Copy link

Reviewed the details for @parasharrajat. Payment summarized above by BZ member is approved for payment in NewDot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests

8 participants