BelkacemYerfa / shadcn-extension

An open source component collection , that extends your ui library , built using shadcn component
https://shadcn-extension.vercel.app/
MIT License
952 stars 37 forks source link

Multi Select with react-hook-form has issues #70

Closed Roopaish closed 5 months ago

Roopaish commented 5 months ago

In the react hook form, the value that is in field is undefined initially , which can't be iterated and it causes client side exception.

I fixed it by making this change

const MultiSelector = ({
  values,
  onValuesChange: onValueChange,
  loop = false,
  className,
  children,
  dir,
  ...props
}: MultiSelectorProps) => {
const value = Array.isArray(values) ? values : []
.....