33import React from "react" ;
44import { Button } from "@/components/ui/button" ;
55import { useToast } from "@/components/ui/use-toast" ;
6- import { Input } from "@mui/material" ;
76import { Loader2Icon } from "lucide-react" ;
87import { useForm } from "react-hook-form" ;
98
@@ -26,8 +25,8 @@ export default function ApplicantStep2({
2625 user : any ;
2726 applicantData : ApplicantType ;
2827} ) {
29- const takenTest = applicantData . test_taken ? true : false ; // Replace with actual logic to check if the test has been taken
30- const submittedTest = applicantData . fork_url ? true : false ; // Replace with actual logic to check if the test has been submitted
28+ const takenTest = applicantData . test_taken ? true : false ;
29+ const submittedTest = applicantData . fork_url ? true : false ;
3130
3231 return (
3332 < div className = "my-20 flex flex-col items-center gap-8 text-center lg:gap-10" >
@@ -149,10 +148,9 @@ function PostReadInstructions({
149148 const onSubmit = async ( data : any ) => {
150149 setLoading ( true ) ;
151150 try {
152-
153151 /* if non ui/ux role */
154152 if ( user ?. display_position . includes ( "UI/UX Designer" ) === false ) {
155- //validate the fork url
153+ // Validate the fork url
156154 const urlPattern =
157155 / ^ ( h t t p s ? : \/ \/ ) ? ( w w w \. ) ? g i t h u b \. c o m \/ [ a - z A - Z 0 - 9 _ - ] + \/ c o d e b i l i t y - a s s e s s m e n t ( \/ .* ) ? $ / ;
158156
@@ -204,7 +202,8 @@ function PostReadInstructions({
204202
205203 < form onSubmit = { handleSubmit ( onSubmit ) } >
206204 < div className = "flex w-full max-w-md flex-col gap-4" >
207- < Input
205+ { /* FIX: replaced MUI Input with native input — MUI Input breaks react-hook-form's ref, causing data.fork_url to always be undefined on submit */ }
206+ < input
208207 { ...register ( "fork_url" , {
209208 required : "This field is required" ,
210209 } ) }
@@ -222,6 +221,7 @@ function PostReadInstructions({
222221 { String ( errors . fork_url . message ) }
223222 </ p >
224223 ) }
224+
225225 < div className = "flex flex-col gap-4 *:w-[16rem] sm:flex-row sm:*:w-auto" >
226226 { user ?. display_position . includes ( "UI/UX Designer" ) ? (
227227 < TestQAInstruction applicantData = { applicantData } >
@@ -281,10 +281,9 @@ function PostSubmitted({
281281 const onSubmit = async ( data : any ) => {
282282 setLoading ( true ) ;
283283 try {
284-
285284 /* if non ui/ux role */
286285 if ( user ?. display_position . includes ( "UI/UX Designer" ) === false ) {
287- //validate the fork url
286+ // Validate the fork url
288287 const urlPattern =
289288 / ^ ( h t t p s ? : \/ \/ ) ? ( w w w \. ) ? g i t h u b \. c o m \/ [ a - z A - Z 0 - 9 _ - ] + \/ c o d e b i l i t y - a s s e s s m e n t ( \/ .* ) ? $ / ;
290289
@@ -322,6 +321,7 @@ function PostSubmitted({
322321 }
323322 setLoading ( false ) ;
324323 } ;
324+
325325 return (
326326 < >
327327 < div className = "flex flex-col items-center gap-4" >
@@ -336,7 +336,8 @@ function PostSubmitted({
336336
337337 < form onSubmit = { handleSubmit ( onSubmit ) } >
338338 < div className = "flex w-full max-w-md flex-col gap-4" >
339- < Input
339+ { /* FIX: replaced MUI Input with native input — same ref issue as PostReadInstructions */ }
340+ < input
340341 { ...register ( "fork_url" , {
341342 required : "This field is required" ,
342343 } ) }
@@ -398,4 +399,4 @@ function PostSubmitted({
398399 </ div >
399400 </ >
400401 ) ;
401- }
402+ }
0 commit comments