fix(@yourssu/logging-system): unload event 시 서버로 log 전송 #44
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
1️⃣ 어떤 작업을 했나요? (Summary)
기존 코드에 영향을 미치지 않는 변경사항
기존 코드에 영향을 미치는 변경사항
demo
에YLSWrapper
를 추가했습니다.unload
이벤트를YLSProvider
에서useEffect
를 통해 추가합니다.버그 픽스
unload
이벤트가 정상적으로 실행됩니다.2️⃣ 알아두시면 좋아요!
기존의 문제점은 크게 두 가지입니다.
getEventListeners(window)
를 찍어봤을 때 전송 이벤트가 추가되지 않았었습니다.useYLSContext
을Context Provider
외부에서 사용합니다. (문제가 되는 지는 잘 모르겠네요...)따라서
Provider
내부에서useEffect
훅을 통해 이벤트 리스너를 추가하는 방식으로 변경했습니다.결과적으로 페이지를 이탈했을 때 이벤트가 잘 실행됩니다.
3️⃣ 추후 작업
api 호출 이후에 localStorage를 비움으로써 생기는 문제점에 대해 의논한 후, 중복 로그 전송 문제를 해결
4️⃣ 체크리스트 (Checklist)
main
브랜치의 최신 코드를pull
받았나요?