pacocoursey / cmdk

Fast, unstyled command menu React component.
https://cmdk.paco.me
MIT License
9.98k stars 287 forks source link

(Input): `defaultValue` does not render and throws warning #279

Open ryparker opened 4 months ago

ryparker commented 4 months ago

Passing a defaultValue into an uncontrolled <Command.Input /> causes a console warning and the value does not appear in the input.

warning in console:

Warning: Primitive.input contains an input of type text with both value and defaultValue props. Input elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props.

Reproduced demo: https://codesandbox.io/p/sandbox/cmdk-default-value-bug-qpkpwv

ajaralampidis commented 3 months ago

This was marked as done here https://github.com/pacocoursey/cmdk/pull/123, but it's not working at all. I am having the same error as @ryparker

3li7u commented 3 months ago

I have the same problem I passed a defaultValue but it does not appear in the input search field

3li7u commented 3 months ago

This was marked as done here #123, but it's not working at all. I am having the same error as @ryparker

This PR talks about defaultValue of Command Component, but we talk about Command.Input