Skip to content

Commit

Permalink
[fix] boostcampwm-2022#3 채팅방 클릭 이벤트 수정
Browse files Browse the repository at this point in the history
- 내부 어떤 요소를 클릭하든 id를 찾을 수 있도록 변경
  • Loading branch information
ktmihs committed Dec 4, 2022
1 parent 1a5677d commit d4f91a9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions frontend/src/component/Sidebar/Chat/ChatList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ const ChatList = ({ setChatTarget }: { setChatTarget: Function }) => {
}, []);

const selectChatRoom = (e: React.MouseEvent<HTMLElement>) => {
if (!(e.target instanceof HTMLElement)) return;
const target = e.target as HTMLUListElement;
const id = target.closest('li')?.dataset.id;

if (e.target.dataset.id) {
setIsClose(true);
if (!id) return;

setTimeout(() => {
if (!(e.target instanceof HTMLElement)) return;
setChatTarget(e.target.dataset.id);
}, 300);
}
setIsClose(true);

setTimeout(() => {
setChatTarget(id);
}, 300);
};

return (
Expand Down

0 comments on commit d4f91a9

Please sign in to comment.