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-05-25] [$1000] Emoji gets added in between the text when selecting text and add new emoji by search and enter #18515

Closed
2 of 6 tasks
kavimuru opened this issue May 5, 2023 · 36 comments
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 May 5, 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. Open the app
  2. Open any report
  3. Write multiple emojis (any emojis are fine) in compose box
  4. Select the emojis and open emoji picker
  5. Search for any emoji and press enter to insert the emoji (do not click to select)

Expected Result:

App should remove the emojis as it does normally when we select the emoji by clicking on it.

Actual Result:

App adds emoji in the middle of existing emojis

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

emojis.added.in.middle.of.existing.emojis.on.select.and.add.mp4
Recording.506.mp4

Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1683280230048149

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01bf65aebce0e7ee33
  • Upwork Job ID: 1655592568939524096
  • Last Price Increase: 2023-05-08
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 5, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 5, 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

@dukenv0307
Copy link
Contributor

dukenv0307 commented May 6, 2023

Proposal

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

Emoji gets added in between the text when selecting text and add new emoji by search and enter

What is the root cause of that problem?

addEmojiToTextBox(emoji) {
this.setState(prevState => ({
selection: {
start: prevState.selection.start + emoji.length,
end: prevState.selection.start + emoji.length,
},
}));
this.updateComment(ComposerUtils.insertText(this.comment, this.state.selection, emoji));
}

When hitting enter on the keyboard, the setState function is executed before ComposerUtils.insertText function is called so that the second param of ComposerUtils.insertText function (selection) is incorrect. This problem doesn't happen when we click by mouse

The root cause is: React may batch multiple setState() calls into a single update for performance. (ref)
When clicking by mouse React doesn't execute immediately and waits to batch multiple setState() calls. But when hitting enter on the keyboard React execute setState immediately

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

We should insert emoji before updating the selection state like this

addEmojiToTextBox(emoji) {
        
        this.updateComment(ComposerUtils.insertText(this.comment, this.state.selection, emoji));
        this.setState(prevState => ({
            selection: {
                start: prevState.selection.start + emoji.length,
                end: prevState.selection.start + emoji.length,
            },
        }));
       
    }

What alternative solutions did you explore? (Optional)

NA

@melvin-bot melvin-bot bot added the Overdue label May 8, 2023
@anmurali
Copy link

anmurali commented May 8, 2023

Cannot reproduce

@anmurali anmurali closed this as completed May 8, 2023
@melvin-bot melvin-bot bot removed the Overdue label May 8, 2023
@anmurali anmurali added the Needs Reproduction Reproducible steps needed label May 8, 2023
@dukenv0307
Copy link
Contributor

dukenv0307 commented May 8, 2023

@anmurali Please try again with these steps:

  1. Open the app
  2. Open any report
  3. Write 2 emojis (any emojis are fine) in compose box
  4. Select all emojis
  5. open emoji picker
  6. Hover any emoji and click enter

My video
https://user-images.githubusercontent.com/129500732/236848003-48cca23f-e786-4072-84fd-21507dcba421.mov

Make sure that you click enter in keyboard to select emoji in step 6

@anmurali anmurali removed the Needs Reproduction Reproducible steps needed label May 8, 2023
@anmurali
Copy link

anmurali commented May 8, 2023

I did do that, but I selected the emoji with a click rather than by hitting enter

@anmurali anmurali reopened this May 8, 2023
@anmurali anmurali added the External Added to denote the issue can be worked on by a contributor label May 8, 2023
@melvin-bot melvin-bot bot changed the title Emoji gets added in between the text when selecting text and add new emoji by search and enter [$1000] Emoji gets added in between the text when selecting text and add new emoji by search and enter May 8, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 8, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 8, 2023

Current assignee @anmurali is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented May 8, 2023

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

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

melvin-bot bot commented May 8, 2023

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

@melvin-bot melvin-bot bot added the Overdue label May 10, 2023
@dangrous
Copy link
Contributor

Waiting for proposals

@melvin-bot melvin-bot bot removed the Overdue label May 10, 2023
@dukenv0307
Copy link
Contributor

@dangrous I posted a proposal, please help to look at it
cc @mollfpr

@mollfpr
Copy link
Contributor

mollfpr commented May 11, 2023

Thanks @dukenv0307, for the proposal!

Before the PR #17346 we used the selection state before it's update in this file. So it makes sense that we move it early before the new setState.

@dangrous Let's go with @dukenv0307 proposal.

🎀 👀 🎀 C+ reviewed!

@dangrous
Copy link
Contributor

Ah yep, that makes sense to me! Assigning this now!

@dukenv0307 out of curiosity, do you know why does it fire immediately on enter and not on mouse click?

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production labels May 18, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Emoji gets added in between the text when selecting text and add new emoji by search and enter [HOLD for payment 2023-05-25] [$1000] Emoji gets added in between the text when selecting text and add new emoji by search and enter May 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 18, 2023

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label May 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 18, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.15-12 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-05-25. 🎊

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

@melvin-bot
Copy link

melvin-bot bot commented May 18, 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:

  • [@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
  • [@mollfpr] 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:
  • [@mollfpr] 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:
  • [@mollfpr] Determine if we should create a regression test for this bug.
  • [@mollfpr] 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.
  • [@anmurali] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels May 24, 2023
@dangrous
Copy link
Contributor

@mollfpr do you have time to take a look at that checklist? Thanks!

@mollfpr
Copy link
Contributor

mollfpr commented May 25, 2023

[@mollfpr] The PR that introduced the bug has been identified. Link to the PR:

#17346

[@mollfpr] 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:

#17346 (comment)

[@mollfpr] 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/p1684989964993659

[@mollfpr] Determine if we should create a regression test for this bug.

I think we should; it's easy to miss this kind of bug while testing/review.

[@mollfpr] 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.

Propose regression step

  1. Open the app
  2. Open any report
  3. Write 2 emojis (any emojis are fine) in compose box
  4. Select the two above emojis and open emoji picker
  5. Hover the mouse over any emoji and hit enter on the keyboard
  6. Verify that the before emojis are removed and the new emoji is added
  7. 👍 or 👎

@dangrous
Copy link
Contributor

Test looks good to me!

@melvin-bot melvin-bot bot added the Overdue label May 29, 2023
@mollfpr
Copy link
Contributor

mollfpr commented May 30, 2023

Bump @anmurali to help with the payment

@melvin-bot melvin-bot bot removed the Overdue label May 30, 2023
@anmurali
Copy link

I can't find either of you on Upwork since I only have your GH and Slack profile handles. Asked here

@dukenv0307
Copy link
Contributor

@anmurali here's my profile: https://www.upwork.com/freelancers/~01f5cbe690701118a2
Thanks!

@anmurali
Copy link

anmurali commented Jun 1, 2023

Added regression test - https://github.com/Expensify/Expensify/issues/288154
Sent offers, waiting to accept to pay

@dhanashree-sawant
Copy link

Thanks @anmurali, I have accepted the offer.

@melvin-bot melvin-bot bot added the Overdue label Jun 5, 2023
@dangrous
Copy link
Contributor

dangrous commented Jun 5, 2023

Are we still waiting on the accepted offers, or are we good to close?

@melvin-bot melvin-bot bot removed the Overdue label Jun 5, 2023
@anmurali
Copy link

anmurali commented Jun 5, 2023

Paid.

@anmurali anmurali closed this as completed Jun 5, 2023
@dukenv0307
Copy link
Contributor

dukenv0307 commented Jul 19, 2023

hi @anmurali , I think this issue is eligible for the PR timeline bonus, see here, but it seems the payout didn't have it.

Could you help to double check?
Thank you!

@dukenv0307
Copy link
Contributor

@anmurali would you mind checking the above comment? Thanks!

@anmurali
Copy link

anmurali commented Aug 3, 2023

Added bonus to @dukenv0307 and @mollfpr

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

6 participants