ITADN

[TroubleShooting] 게스트 모드에서 게임 시작이 안되는 버그

#373Closednijuy 创建于 2025-07-14
N
nijuycommented
<img width="464" height="81" alt="Image" src="https://github.com/user-attachments/assets/015a3bb5-9678-42f3-8cdd-9860922014d5" /> 난바보야............................................. <img width="300" src="https://camo.githubusercontent.com/12a8f2120bcc2db43379740272082d0bdb58041d01eeb5fc6483636ce3491d25/68747470733a2f2f74312e6461756d63646e2e6e65742f6272756e63682f736572766963652f757365722f636e6f432f696d6167652f744e57453661684d384c303775616a38317134486a464436717259" /> # 문제 상황 - `fetchUserItem()` 호출 시, 게스트 사용자의 경우 API 요청을 건너뛰고 빈 배열을 반환함 - 피버타임 숨김 처리를 위해 `this.itemBar.setup()` 호출 시 `items[0]`을 바로 참조하도록 수정함 - 빈 배열에서 [0]에 접근하면서 예외가 발생함 ```ts this.itemBar.setup([ { ...items[0], // 이것. onUse: async (type) => { this.snackGame.setSelectedItem(type); }, }, ]); ``` 빈 배열 가지고 [0]을 참조하니까... 당연히 못찾음............................. <img width="538" height="101" alt="Image" src="https://github.com/user-attachments/assets/fec39f7b-9eca-4c3c-aad6-0eace7d23197" /> - 그리고 `fetchUserItem` 내의 게스트 확인 로직도 타이밍 어긋나서 제대로 안 돌아갈 때가 있음 <img width="546" height="246" alt="Image" src="https://github.com/user-attachments/assets/fcd95a9e-051a-4428-b04a-f24241c0b864" /> > 게스트 로그인 성공해서 - 로컬 스토리지에 유저 정보 세팅했는데 - type을 못 읽는 점에서 그렇게 생각함 # 개선 방향 이게 다 프론트에서 임의로 빈 배열을 반환하는 탓이다 <img width="658" height="457" alt="Image" src="https://github.com/user-attachments/assets/d447740b-cb48-4cfe-b3af-e9721585425f" /> 지난 회의록을 참고하면 어차피 이제 게스트도 items가 빈 배열이 아니기 때문에 `fetchUserItem`에 있던 게스트 확인 로직 날려버리겠어 다 API 응답 사용하도록
关闭于 2025-07-14 0 条评论