@@ -104,7 +104,7 @@ interface ValidationErrors {
104104}
105105
106106export default function RecruiterSignup ( ) {
107- const [ companies , setCompanies ] = useState ( [ ] ) ;
107+ const [ companies , setCompanies ] = useState < Array < { id : string ; name : string } > > ( [ ] ) ;
108108 const [ createCompany , setCreateCompany ] = useState ( false ) ;
109109 const [ captchaToken , setCaptchaToken ] = useState ( "" ) ;
110110 const [ jaf , setJaf ] = useState < JAFdetailsFC | null > ( null ) ;
@@ -155,10 +155,16 @@ export default function RecruiterSignup() {
155155 getCompanies ( ) ,
156156 getJafDetails ( ) ,
157157 ] ) ;
158- setCompanies ( companiesData ) ;
158+
159+ // Ensure companies is always an array
160+ setCompanies ( Array . isArray ( companiesData ) ? companiesData : [ ] ) ;
159161 setJaf ( jafData ) ;
160162 } catch ( error ) {
163+ console . error ( "Failed to load form data:" , error ) ;
161164 toast . error ( "Failed to load form data. Please refresh the page." ) ;
165+ // Set fallback values
166+ setCompanies ( [ ] ) ;
167+ setJaf ( null ) ;
162168 }
163169 } ;
164170 loadData ( ) ;
@@ -639,7 +645,7 @@ export default function RecruiterSignup() {
639645 Select Company *
640646 </ Label >
641647 < Combobox
642- options = { companies . map (
648+ options = { ( companies || [ ] ) . map (
643649 ( company : { id : string ; name : string } ) => ( {
644650 value : company . id ,
645651 label : company . name ,
@@ -916,10 +922,10 @@ export default function RecruiterSignup() {
916922 </ Label >
917923 < Combobox
918924 options = {
919- jaf ?. countries . map ( ( country ) => ( {
925+ ( jaf ?. countries || [ ] ) . map ( ( country ) => ( {
920926 value : country ,
921927 label : country ,
922- } ) ) || [ ]
928+ } ) )
923929 }
924930 value = { companyInfo . address . country }
925931 onChange = { ( value ) => {
0 commit comments