[fix] "브라우저로 연결하기" 실패 후 재선택 시 시리얼 포트 미해제 버그 수정#3080
Open
hcooch2ch3 wants to merge 3 commits into
Open
Conversation
018561d to
f1d46de
Compare
f1d46de to
7e4f51f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #3081
변경 사항
"브라우저로 연결하기"에서 연결이 한 번 실패하면 그 뒤로 "연결하기"를 몇 번을 눌러도 계속 실패하고, 페이지를 새로고침해야만 복구되는 문제를 수정했습니다. (커밋 3개, 2파일, +13/−2)
constantServing루프가 계속 돌던 종료 조건 보강새 API 없이 기존 public 메서드
removeSerialPort()와 기존 필드this.serial만 사용했습니다. BLE 연결 경로는 건드리지 않습니다.참고사항
원인은 다음과 같습니다.
SerialPort객체를 돌려주기 때문에, 포트가 열린 채 남아 있으면 다음 연결의open()이InvalidStateError: The port is already open.으로 실패합니다.특정 교구만의 문제가 아니라 Web Serial을 쓰는 하드웨어 라이트 모듈 30종 전체에 해당합니다. 무선 동글류처럼 핸드셰이크가 실패할 수 있는 교구에서, 교실에서 흔한 "실패하면 다시 연결 반복" 동선 그대로 재현됩니다.
수정 전 재현 방법:
InvalidStateError: The port is already open.으로 실패하고, 이후 모든 재시도도 동일하게 실패합니다.테스트 항목
실기 검증 환경: macOS + Chrome, 로보메이션 햄스터/거북이 + 공용 무선 동글
InvalidStateError재현 확인npm run dist빌드 통과(타입 에러 0), 수정 파일 eslint 통과 확인