File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,10 @@ export const upsertCompanyAction = authActionClient
1616 . schema (
1717 z . object ( {
1818 id : z . string ( ) . optional ( ) ,
19- name : z . string ( ) ,
19+ name : z
20+ . string ( )
21+ . trim ( )
22+ . min ( 2 , { message : "Name must be at least 2 characters." } ) ,
2023 image : z . string ( ) . url ( ) . nullable ( ) ,
2124 slug : z . string ( ) . optional ( ) ,
2225 location : z . string ( ) . nullable ( ) ,
@@ -31,7 +34,7 @@ export const upsertCompanyAction = authActionClient
3134 async ( {
3235 parsedInput : {
3336 id,
34- name : rawName ,
37+ name,
3538 image,
3639 slug,
3740 location,
@@ -45,7 +48,6 @@ export const upsertCompanyAction = authActionClient
4548 } ) => {
4649 const supabase = await createClient ( ) ;
4750
48- const name = rawName . trim ( ) ;
4951 const nameKey = name . toLowerCase ( ) ;
5052
5153 // Only treat the request as an edit when a row with the provided id
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ export function CompanyList({ data }: { data?: Company[] | null }) {
2323
2424 // With a search term, query the entire companies table rather than
2525 // filtering only the rows that happen to be loaded on the page.
26+ setCompanies ( [ ] ) ;
2627 let active = true ;
2728 const handle = setTimeout ( async ( ) => {
2829 const results = await searchCompanies ( term ) ;
Original file line number Diff line number Diff line change @@ -143,6 +143,7 @@ export function CompanySelect({
143143 return ;
144144 }
145145
146+ setResults ( [ ] ) ;
146147 let active = true ;
147148 setLoading ( true ) ;
148149
You can’t perform that action at this time.
0 commit comments