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.
작업 내용
새로고침할 때 생기는 문제가 아니였다. 랜덤하게 발생하는 문제였다.
소켓 연결이 끊기는게 아니라, 가끔 소켓 연결이 되기전에 구독함수를 먼저 하려고 한다.
(비동기 함수도 아닌데 왜 실행순서를 안지키는지 모르겠다;;)
useState를 하나 추가-> useEffect 의존성 배열에 추가 -> 웹소켓 연결이 될 때 상태 변경 -> 트리거 되어서 구독하는 함수를 한번더 호출
따라서 먼저 구독을 시도했을 경우, 연결됐을 때 한 번 더 실행함으로서 해결.
close #141