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-03-14] [$2000] Editing status doesn't sync correctly between tabs. #15284

Closed
1 task
kavimuru opened this issue Feb 19, 2023 · 42 comments
Closed
1 task
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@kavimuru
Copy link

kavimuru commented Feb 19, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Login with any account.
  2. Open the same report in 2 tab.
  3. Enter same text in the compose field of both the tabs
  4. In the first tab, delete the text, notice that the edit icon disappears. Move to the second tab, try to edit the draft.

Expected Result:

Editing status should sync correctly between tabs, so the editing icon should appear in the second tab

Actual Result:

Editing status does not sync, edit icon does not appear

Workaround:

unknown

Platforms:

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

  • MacOS / Chrome / Safari

    Version Number: 1.2.74-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:

Recording.1557.mp4
Screen.Recording.2023-02-18.at.18.03.18.mov

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e4c499136c20d7f1
  • Upwork Job ID: 1627782388739874816
  • Last Price Increase: 2023-02-27
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Feb 19, 2023
@MelvinBot
Copy link

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

@melvin-bot melvin-bot bot locked and limited conversation to collaborators Feb 19, 2023
@MelvinBot
Copy link

MelvinBot commented Feb 19, 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

I repro'd on both prod and staging:

2023-02-20_13-21-49.mp4
  • 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

@greg-schroeder greg-schroeder added the External Added to denote the issue can be worked on by a contributor label Feb 20, 2023
@melvin-bot melvin-bot bot unlocked this conversation Feb 20, 2023
@melvin-bot melvin-bot bot changed the title Editing status doesn't sync correctly between tabs. [$1000] Editing status doesn't sync correctly between tabs. Feb 20, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

Current assignee @greg-schroeder is eligible for the External assigner, not assigning anyone new.

@MelvinBot
Copy link

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

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

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

@osofus
Copy link

osofus commented Feb 21, 2023

Proposal

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

When a draft is cleared on one tab, it removes the "drafted message" indicator.
The indicator does not return on another active tab where text is being edited, unless the draft on that tab is completely cleared and then edited.

What is the root cause of that problem?

The reason for the "drafted message" indicator to remain absent on the other tab is because of how we check whether the "drafted message" icon has to displayed.
We activate the "hasDraft" flag only when the original text has 0 length. Due to this, unless the original text is reset to blank on the other tab, the "drafted message" never gets activated.

This check is in updateComment method of ReportActionCompose class in ReportActionCompose.js.

// Indicate that draft has been created.
if (this.comment.length === 0 && newComment.length !== 0) {
Report.setReportWithDraft(this.props.reportID, true);
}

// The draft has been deleted.
if (newComment.length === 0) {
Report.setReportWithDraft(this.props.reportID, false);
}

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

The check, for whether draft is being created, should be updated to something like this:

// Indicate that draft has been created.
if (newComment.length !== 0 && this.comment !== newComment) {
Report.setReportWithDraft(this.props.reportID, true);
}

Result is attached:

Proposal.15284.mov

What alternative solutions did you explore?

No other solution is necessary.

@bernhardoj
Copy link
Contributor

bernhardoj commented Feb 21, 2023

Proposal

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

We are trying to synchronize draft status between tabs.

What is the root cause of that problem?

When we type something into the composer whether on the 1st or 2nd tab, the hasDraft status will be true. When we remove the draft from 1 tab, the hasDraft status will be false and reflected on both tabs, so the pencil icon gone.

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

I think what we need to do here is to synchronize the draft comment instead. When we type something into the composer on the 1st tab, then the composer text on the 2nd tab needs to be updated. So, when we delete the draft on the 1st tab, the composer text on the 2nd tab will also be deleted. There will be no case for unsynchronized draft icon.

So, how to do that? We are saving the draft with Onyx and already connect it here.

comment: {
key: ({reportID}) => `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${reportID}`,
},

We need to update the value & isCommentEmpty state and this.comment variable every time the comment changed (the comment could be changed from the current tab or from the other tab) and if the current value state is not the same with the new comment props (to prevent unnecessary set state).

if prev comment != current comment and current value != current comment

I think we can also do the same with edit composer if we want to.

Here is the result.

Screen.Recording.2023-02-20.at.19.52.56.mov

@melvin-bot melvin-bot bot added the Overdue label Feb 21, 2023
@crusaderkarthik
Copy link

crusaderkarthik commented Feb 22, 2023

Proposal


There is lots of deprecated library . I will add new library and resolve all bugs one by one. I have submitted the same proposal in Upwork and I am sure this can be done in 2-3 days

@MelvinBot
Copy link

📣 @crusaderkarthik! 📣

Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.

Screen Shot 2022-11-16 at 4 42 54 PM

Format:

Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@crusaderkarthik
Copy link

Contributor details
Your Expensify account email: crusaderkarthik@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01d72cd377f71be342

@MelvinBot
Copy link

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@s77rt
Copy link
Contributor

s77rt commented Feb 22, 2023

Proposal

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

Report draft status/flag not being set unless the composer is cleared first.

What is the root cause of that problem?

The report draft status (hasDraft field) is only updated if the old text is empty and the new text is not (condition).

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

Instead of relaying on the old text to be empty (not to trigger unnecessary function calls) we can relay on the hasDraft field not to be true. In pseudo code that would be:

if (hasDraft is not true AND new text is not empty)
    set hasDraft to true
endif

What alternative solutions did you explore? (Optional)

None

@eVoloshchak
Copy link
Contributor

@osofus, great job on finding the root cause, the proposal resolves the issue. I found what feels like an issue: the edited icon is synced between tabs, while draft message isn't. It is updated as soon as you type something into the input

Screen.Recording.2023-02-22.at.22.01.56.mov

@melvin-bot melvin-bot bot removed the Overdue label Feb 22, 2023
@MelvinBot
Copy link

📣 @eVoloshchak! 📣

Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.

Screen Shot 2022-11-16 at 4 42 54 PM

Format:

Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@eVoloshchak
Copy link
Contributor

Hi, @crusaderkarthik!
Please take a look at our contributing guides and post a proposal following the proposal template

@MelvinBot
Copy link

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@eVoloshchak
Copy link
Contributor

I think @bernhardoj's proposal is the best, syncing the draft comment on all tabs will eliminate this issue, as well as the issue I was describing above.
I'm not 100% sure though, since this might be an intentional behavior (having comment drafts in different tabs not sync)
@cristipaval, what do you think?

@bernhardoj
Copy link
Contributor

PR is ready for review.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Mar 7, 2023
@melvin-bot melvin-bot bot changed the title [$2000] Editing status doesn't sync correctly between tabs. [HOLD for payment 2023-03-14] [$2000] Editing status doesn't sync correctly between tabs. Mar 7, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 7, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.79-0 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-03-14. 🎊

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.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

@MelvinBot
Copy link

MelvinBot commented Mar 7, 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:

  • [@eVoloshchak / @cristipaval] The PR that introduced the bug has been identified. Link to the PR:
  • [@eVoloshchak / @cristipaval] 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:
  • [@eVoloshchak / @cristipaval] 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:
  • [@greg-schroeder] Determine if we should create a regression test for the bug.
  • [@eVoloshchak] If we decide to create a regression test for the bug, please propose the regression test steps to the appropriate location to ensure the same bug will not reach production again.
  • [@greg-schroeder] Review the proposed regression test steps and location.
  • [@greg-schroeder] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@MelvinBot
Copy link

Looks like something related to react-navigation may have been mentioned in this issue discussion.

As a reminder, please make sure that all proposals are not workarounds and that any and all attempt to fix the issue holistically have been made before proceeding with a solution. Proposals to change our DeprecatedCustomActions.js files should not be accepted.

Feel free to drop a note in #expensify-open-source with any questions.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Mar 13, 2023
@eVoloshchak
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: original PR that implemented this logic is 2 years old, i think this was an expected behaviour at the time

  • 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: N/A

  • 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: https://expensify.slack.com/archives/C049HHMV9SM/p1678881972933209

@melvin-bot melvin-bot bot added the Overdue label Mar 17, 2023
@cristipaval
Copy link
Contributor

Thank you @eVoloshchak !

I think this one is on you now, @greg-schroeder

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Mar 17, 2023
@cristipaval
Copy link
Contributor

I wonder if Melvin is not ok or I am missing something. He removes and instantly adds back the Overdue label?

@melvin-bot melvin-bot bot removed the Overdue label Mar 20, 2023
@eVoloshchak
Copy link
Contributor

@cristipaval, yeah, I noticed this in other issues too.
There's a recent discussion about this in slack

@greg-schroeder
Copy link
Contributor

I apologize, I was out unexpectedly and I'm working on catching up. Will take care of this ASAP

@greg-schroeder
Copy link
Contributor

Sorry again for the delay while I was out - offers sent to @hungvu193, @eVoloshchak, @bernhardoj. I'll take care of this ASAP

@bernhardoj
Copy link
Contributor

I get "This offer is not available anymore".

@melvin-bot melvin-bot bot added the Overdue label Mar 27, 2023
@greg-schroeder
Copy link
Contributor

Okay let's try this again @bernhardoj - I'm sending it again now.

@melvin-bot melvin-bot bot removed the Overdue label Mar 27, 2023
@bernhardoj
Copy link
Contributor

Accepted!

@greg-schroeder
Copy link
Contributor

Paid

@greg-schroeder
Copy link
Contributor

Added regression test https://github.com/Expensify/Expensify/issues/271583

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. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

9 participants