vantezzen / auto-form

🌟 A React component that automatically creates a @shadcn/ui form based on a zod schema.
https://vantezzen.github.io/auto-form/
2.29k stars 81 forks source link

optional() for enums breaks the app #10

Closed dissorial closed 11 months ago

dissorial commented 11 months ago

For example, this would break the app

color: z.enum(['red', 'green', 'blue']).optional()

Resulting in:

TypeError: Cannot read properties of undefined (reading 'map')
// components\ui\auto-form.tsx (409:20) @ map
  407 | </SelectTrigger>
  408 | <SelectContent>
> 409 |   {values.map((value: any) => (
      |          ^
  410 |     <SelectItem value={value} key={value}>
  411 |       {value}
  412 |     </SelectItem>