[fix] 모의 성적 계산하기 유형 전환 시 폼 리셋 누락 수정#412
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a handleBackClick function in CalculatePage to reset form values (including gedAvgScore to null) and clear error/graduation states when navigating back. The back button's click handler was updated to use this new function. The reviewer recommended also adding gedAvgScore: null to the defaultValues of the useForm declaration to ensure consistent initial state and prevent potential React warnings regarding uncontrolled-to-controlled inputs.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
개요 💡
모의 성적 계산하기에서 검정고시 유형으로 입력 후 "이전" 버튼을 눌러 다른 유형(졸업 예정/졸업자)으로 전환하면, 모든 값을 입력해도 "내 성적 계산하기" 버튼이 활성화되지 않는 버그를 수정했습니다.
작업내용 ⌨️
handleBackClick에서step4UseForm.reset()을 호출해 폼 상태를 초기화하는데, 이때 전달하는 reset 객체에gedAvgScore필드가 누락되어 있었습니다.gedAvgScore는 스키마상z.nullable(z.number()...)로 정의되어 있어 null은 허용하지만undefined는 허용하지 않습니다. reset 객체에 포함되지 않은 필드는 RHF에 의해undefined로 초기화되기 때문에, reset 직후gedAvgScore가undefined상태가 되어step4Schema.safeParse()가 실패하고isStep4Success가 계속 false로 고정되었습니다.handleBackClick의 reset 객체에gedAvgScore: null을 추가하여, 유형 전환 시 폼이 정상적으로 valid 상태가 되도록 수정했습니다.관련 이슈 🚨
모의 성적 계산하기 → 검정고시로 입력 후 "이전" → 다른 유형 선택 후 입력 시 "내 성적 계산하기" 버튼이 활성화되지 않는 문제
#410