Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.54k stars 2.88k forks source link

[HOLD for payment 2024-06-11] [$250] Chat - Emoji is deleted if entered quickly after some text #41778

Closed izarutskaya closed 4 months ago

izarutskaya commented 6 months ago

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


Version Number: v1.4.71-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: https://expensify.testrail.io/index.php?/tests/view/4544514 Email or phone of affected tester (no customers): vdargentotest+ios050724@gmail.com Logs: https://stackoverflow.com/c/expensify/questions/4856 Issue reported by: Applause-Internal team

Action Performed:

Pre-requisite: user must be logged in.

  1. Go to any chat.
  2. Tap on the compose box.
  3. Enter any text but do not send the message.
  4. Tap on the emoji picker and quickly select any emoji. (Note: don't add a space between the word and the emoji)
  5. Verify it appears for a moment on the compose box, but suddenly disappears.

Expected Result:

The selected emoji should remain on the compose box.

Actual Result:

The selected emoji is displayed for a moment, but suddenly disappears.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

https://github.com/Expensify/App/assets/115492554/f3bb9143-dec2-4e32-98e8-1e3e1343bfbf

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f96963f235e9c546
  • Upwork Job ID: 1787904276326506496
  • Last Price Increase: 2024-05-07
  • Automatic offers:
    • hungvu193 | Reviewer | 0
Issue OwnerCurrent Issue Owner: @trjExpensify
melvin-bot[bot] commented 6 months ago

Triggered auto assignment to @trjExpensify (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.

izarutskaya commented 6 months ago

We think this issue might be related to the #vip-vsb.

trjExpensify commented 6 months ago

I can reproduce this. You have to add the emoji to the end of the text with no space for it to disappear.

melvin-bot[bot] commented 6 months ago

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

melvin-bot[bot] commented 6 months ago

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

roitman-g commented 6 months ago

Proposal

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

When you enter some text (it can also be space in the end) and then insert an emoji in less than a second after finishing typing, the emoji is being removed. This also can be reproduced in any other platform, just be quick.

What is the root cause of that problem?

In "ComposerWithSuggestions" component "updateComment" function a comment update with regular text is saved with the debounced function, while comment update with emoji is not. So what happens is first the comment with the emoji is being saved and then the debounced function is being invoked with the old value, reverting the comment to the previous non-emoji state.

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

There are two way to solve this issue.

  1. Either adding debouncedSaveReportComment.flush() line of code when updating the comment with the emoji in "updateComment" function. This will invoke the debounced function before the emoji insertion.
  2. Or save emoji with debounced function. So updateComment(ComposerUtils.insertText(commentRef.current, selection, text), true); in "replaceSelectionWithText" function. This will update the debounced function and invoke it with the correct value.

What alternative solutions did you explore? (Optional)

N/A

melvin-bot[bot] commented 6 months ago

@trjExpensify, @hungvu193 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

hungvu193 commented 6 months ago

I'll review it tmr

hungvu193 commented 6 months ago

Thanks @roitman-g, your proposal makes sense to me, do you know which PR cause this issue?

roitman-g commented 6 months ago

Thanks @roitman-g, your proposal makes sense to me, do you know which PR cause this issue?

I am not sure, the bug was probably introduced the same time the emoji insertion functionality and debounced comment caching was first written. But it is very difficult to follow the commits back to that place, since these lines were overwritten by many different commits both for the debounced save draft and emoji insertion.

hungvu193 commented 5 months ago

@roitman-g 's proposal here looks good to me. I'd prefer the first solution. πŸŽ€ πŸ‘€ πŸŽ€ C+ reviewed

melvin-bot[bot] commented 5 months ago

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

iwiznia commented 5 months ago

Hmmmm curious why you think first solution is better than the 2nd one @hungvu193, it seems to me like comment with or without emoji should be saved debounced so that any comment works the same way.... Also @roitman-g which one do you think is better and why?

hungvu193 commented 5 months ago

Yeah, it's just my opinion because we can't enter many emojis at the same time so we don't need to debounce it like we did with comments

roitman-g commented 5 months ago

I would go with the second, it seems simpler. What if the app is changed so that many emojis can be inserted or any other feature with some other multiple selections is added.

iwiznia commented 5 months ago

You can paste a message with many emojis, no? But also I agree is simpler and makes it work the same no matter what you write. Let's go with the second one.

melvin-bot[bot] commented 5 months ago

πŸ“£ @hungvu193 πŸŽ‰ An offer has been automatically sent to your Upwork account for the Reviewer role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job

melvin-bot[bot] commented 5 months ago

πŸ“£ @roitman-g You have been assigned to this job! Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review πŸ§‘β€πŸ’» Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs! Keep in mind: Code of Conduct | Contributing πŸ“–

hungvu193 commented 5 months ago

You can paste a message with many emojis, no?

Yeah you can, but even you paste it, it will be debounced because it's treated as comment. But yeah, let go with 2 to make it consistent with comment.

hungvu193 commented 5 months ago

@roitman-g Do you have any ETA for the PR?

roitman-g commented 5 months ago

@roitman-g Do you have any ETA for the PR?

I will do it by Sunday.

roitman-g commented 5 months ago

PR is ready for review

hungvu193 commented 5 months ago

PR was approved, waiting for merge freeze over.

hungvu193 commented 5 months ago

Same

melvin-bot[bot] commented 5 months ago

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

melvin-bot[bot] commented 5 months ago

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

If no regressions arise, payment will be issued on 2024-06-11. :confetti_ball:

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

melvin-bot[bot] commented 5 months ago

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:

hungvu193 commented 5 months ago

Regression test:

  1. Open any chat.
  2. Type some text.
  3. Quickly insert some emoji with the help of the app's emoji picker.
  4. Verify the emoji is not deleted after that. Do we πŸ‘ or πŸ‘Ž ?
trjExpensify commented 5 months ago

Thanks, @hungvu193! I don't think we need a standalone regression test for this, it was caught while executing an existing one as per the OP link.

Payment summary as follows:

Hans is paid. @roitman-g, can you send me your Upwork profile please?

hungvu193 commented 5 months ago

@trjExpensify can you check upwork again? I think contract was ended without payment image

roitman-g commented 5 months ago

Thanks, @hungvu193! I don't think we need a standalone regression test for this, it was caught while executing an existing one as per the OP link.

Payment summary as follows:

  • $250 to @hungvu193 for the C+ review
  • $250 to @roitman-g for the fix

Hans is paid. @roitman-g, can you send me your Upwork profile please?

May I use this upwork account for this - https://www.upwork.com/freelancers/~0197cfa7f554b66970?

trjExpensify commented 4 months ago

@hungvu193 looks paid to me:

image

May I use this upwork account for this - https://www.upwork.com/freelancers/~0197cfa7f554b66970?

Yeah @roitman-g, if that's your Upwork profile? πŸ˜•

iwiznia commented 4 months ago

Anything else to do here?

trjExpensify commented 4 months ago

@roitman-g can you confirm on this?

Yeah @roitman-g, if that's your Upwork profile? πŸ˜•

roitman-g commented 4 months ago

@roitman-g can you confirm on this?

Yeah @roitman-g, if that's your Upwork profile? πŸ˜•

It is not mine, it is my brother's, I need to prepare my documents to verify my upwork. If it needs to be my upwork, can I send it in the next two weeks?

trjExpensify commented 4 months ago

Sounds good, @roitman-g. I've sent an offer to that Upwork profile. Please accept and then I'll pay and close this issue out.

trjExpensify commented 4 months ago

Paid, closing!