Skip to content

Commit

Permalink
Merge pull request #25419 from daordonez11/fix-double-paste-composer
Browse files Browse the repository at this point in the history
Fix for double paste in composer after function component mig
  • Loading branch information
bondydaa authored Aug 17, 2023
2 parents 5a1b35c + 1bb53e7 commit 8a856e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/Composer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,18 +363,18 @@ function Composer({
}

if (textInput.current) {
textInput.current.addEventListener('paste', handlePaste);
document.addEventListener('paste', handlePaste);
textInput.current.addEventListener('wheel', handleWheel);
}

return () => {
unsubscribeFocus();
unsubscribeBlur();
document.removeEventListener('paste', handlePaste);
// eslint-disable-next-line es/no-optional-chaining
if (!textInput.current) {
return;
}
document.removeEventListener('paste', handlePaste);
textInput.current.removeEventListener('wheel', handleWheel);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down

0 comments on commit 8a856e7

Please sign in to comment.