Skip to content

Commit

Permalink
Merge pull request #2179 from daostack/bugfix/CW-2169-blank-page-issue
Browse files Browse the repository at this point in the history
a blank page opens when joining a common #2169
  • Loading branch information
roienatan authored Oct 12, 2023
2 parents 01e21a7 + d9933ae commit 85f6666
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/pages/common/components/ChatComponent/ChatComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,20 @@ export default function ChatComponent({
}
}, [discussionMessages.length]);

useEffect(() => {
const handlePaste = (event) => {
if (event.clipboardData.files.length) {
uploadFiles(event);
}
};

chatInputWrapperRef.current?.addEventListener("paste", handlePaste);

return () => {
chatInputWrapperRef.current?.removeEventListener("paste", handlePaste);
};
}, []);

const renderChatInput = (): ReactNode => {
const shouldHideChatInput = !isChatChannel && (!hasAccess || isHidden);

Expand All @@ -593,20 +607,6 @@ export default function ChatComponent({
return null;
}

useEffect(() => {
const handlePaste = (event) => {
if (event.clipboardData.files.length) {
uploadFiles(event);
}
};

chatInputWrapperRef.current?.addEventListener("paste", handlePaste);

return () => {
chatInputWrapperRef.current?.removeEventListener("paste", handlePaste);
};
}, []);

return (
<>
<ButtonIcon
Expand Down

0 comments on commit 85f6666

Please sign in to comment.