Skip to content

[bug]: Multiselect does not handle controlled mode correctly when inside form #166

@max-refreshworks

Description

@max-refreshworks

Describe the bug

When using the MultiSelect component in "controlled mode" (passing values and onValuesChange props), specifically within a ShadCN form component, selecting an item triggers an infinite render loop and crashes the application with Maximum update depth exceeded.

Affected component/components

MultiSelect

How to reproduce

  1. Wrap MultiSelect in a Shadcn Form
    
  2. Pass values and onValuesChange to the component
    
  3. Click on any MultiSelectItem
    
  4. The application crashes immediately
    

Codesandbox/StackBlitz link

No response

Logs

System Info

Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions