You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2023-08-28] [$1000] Chat - Email is pasted twice in the composer when copied from user profile #25409
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open StagingDeployCash deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
PS: There is another error reading the code. If textInput.current does not exist, the first time the Composer is shown the pasted text will not go through handlePaste
Update after @situchancomment we should handle it as the class component had it before where paste was handled as a document event with document.addEventListener instead of using textInput.current
What changes do you think we should make in order to solve the problem?
Both handlers should be handled the same way, either both are associated with the document to ensure the handler is removed when navigation blur is called or there is a validation to handle each case.
So instead of using textInput.current for paste we can use document for handling the paste event always
Also in the return method of the effect we should do: textInput.current.removeEventListener('paste', handlePaste); or include the same validation to remove the respective handler.
In pseudocode something like if we want to handle both:
What alternative solutions did you explore? (Optional)
Validate if handlePAste is already called in some way and avoid multicall or something like throttle in the same method but too complex for a simple task
The issue in question here was reported by our internal testers. Does what @b4s36t4 commented on here look like a distinct issue to what was reporting here originally to you @situchan ?
I think he's eligible though it's not a formal bug report in slack.
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: Migrate Composer. web #23359 (comment)
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: N/A
Determine if we should create a regression test for this bug.
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.
Regression Test Proposal:
Open any chat
Open any RHP page (i.e. Settings page) and then close
Activity
OSBotify commentedon Aug 17, 2023
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open
StagingDeployCashdeploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:melvin-bot commentedon Aug 17, 2023
Triggered auto assignment to @bondydaa (
Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.situchan commentedon Aug 17, 2023
This was first reported by me - https://expensify.slack.com/archives/C049HHMV9SM/p1692127516386599
daordonez11 commentedon Aug 17, 2023
This error was introduced in this PR #23359
Proposal
Please re-state the problem that we are trying to solve in this issue.
Double paste in composer after copying email prom profile
What is the root cause of that problem?
First of all, the error only happens when the profile is opened (copy email) and then closed because it triggers the handler of navigation focus.
Then there are 2 different paste handlers at the same time, one associated to the whole document and one associated to the input
Hence handlePaste is called 2 times
App/src/components/Composer/index.js
Lines 355 to 366 in 2e1c4e7
PS: There is another error reading the code. If
textInput.currentdoes not exist, the first time the Composer is shown the pasted text will not go throughhandlePasteUpdate after @situchan comment we should handle it as the class component had it before where paste was handled as a document event with
document.addEventListenerinstead of usingtextInput.currentWhat changes do you think we should make in order to solve the problem?
Both handlers should be handled the same way, either both are associated with the document to ensure the handler is removed when navigation blur is called or there is a validation to handle each case.
So instead of using textInput.current for paste we can use document for handling the paste event always
Also in the return method of the effect we should do:
textInput.current.removeEventListener('paste', handlePaste);or include the same validation to remove the respective handler.In pseudocode something like if we want to handle both:
What alternative solutions did you explore? (Optional)
Validate if handlePAste is already called in some way and avoid multicall or something like throttle in the same method but too complex for a simple task
cc @mountiny
StevenKKC commentedon Aug 17, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Email is pasted twice in the composer when copied from user profile.
What is the root cause of that problem?
In
Composercomponent, we add twopasteevent listener.App/src/components/Composer/index.js
Line 358 in e89ea9d
App/src/components/Composer/index.js
Line 366 in e89ea9d
So the text is pasted twice in the composer.
What changes do you think we should make in order to solve the problem?
We should remove one
pasteevent listener.Since adding event listener to
textInput.currentis redundant, we can remove this line.What alternative solutions did you explore? (Optional)
None.
mountiny commentedon Aug 17, 2023
@daordonez11 Are you bale to create a PR for this with a fix now? Its a deploy blocker so urgency is required.
@bondydaa would you like to let the contributor fix this?
90 remaining items
situchan commentedon Aug 23, 2023
I think he's eligible though it's not a formal bug report in slack.
MitchExpensify commentedon Aug 29, 2023
Payment summary:
Reporting: Applause N/A
C: @daordonez11 $1500 (Upwork)
C+: @situchan $1500 (Upwork)
MitchExpensify commentedon Aug 29, 2023
Paid and contracts ended
MitchExpensify commentedon Aug 29, 2023
Bump on BZ steps @situchan
melvin-bot commentedon Sep 1, 2023
@bondydaa, @twisterdotcom, @daordonez11, @MitchExpensify, @situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
situchan commentedon Sep 1, 2023
Regression Test Proposal:
@MitchExpensify I am also eligible for reporting bonus as I reported before this GH is created - #25409 (comment)
MitchExpensify commentedon Sep 1, 2023
Paid reporting bonus!
MitchExpensify commentedon Sep 1, 2023
Added new test request - Thanks everyone!