Skip to content

Commit

Permalink
[Fix] 컴포넌트 언마운트시 SSE 이벤트 close (#28)
Browse files Browse the repository at this point in the history
* fix: 홈 화면 날짜 getDay() -> getDate()로 수정

* feat: Drive 컴포넌트 언마운트시 event close

* feat: console.log 추가
  • Loading branch information
jwo0o0 authored Feb 22, 2024
1 parent 763c0db commit 89a4397
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/components/Drive/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export const Drive = () => {

useEffect(() => {
fetchSSE();
return () => {
console.log("sse close");
eventSource.close();
};
}, []);

return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const Home = () => {
<SubHeader>김모비님, 안녕하세요!</SubHeader>
<DateText>{`${date.getFullYear()}${
date.getMonth() + 1
}${date.getDay()}일 (${getDayName(date)})`}</DateText>
}${date.getDate()}일 (${getDayName(date)})`}</DateText>
</PageHeader>
<Contents>
<Scores />
Expand Down

0 comments on commit 89a4397

Please sign in to comment.