unovue / shadcn-vue

Vue port of shadcn-ui
https://www.shadcn-vue.com/
MIT License
5.2k stars 304 forks source link

[Bug]: first item in v-for generated list of CommandItem is set to disabled and display none #868

Open scottagt opened 1 week ago

scottagt commented 1 week ago

Reproduction

not set

Describe the bug

I'm using Command and CommandList, CommandGroup, and CommandItem. I'm not sure I can replicate it since I do not know a way to mimic and server side call that would be accurate to how data structures are updated in my code.

We conduct a search based on the user query from the CommandInput and receive results from the server. When the results are rendered, the first result is set to disabled and the display is set to none. When the original search query is deleted from the CommandInput the first result is set to display. It seems very odd. We tried using v-model to bind to a ref with the currently selected value (whatever the first server response result is) but it doesn't have an effect.

From what I could figure from looking at ComboboxItem, there is some check being done to see if the searchFilter query is set to "" or if the current item is being returned by the filterFunction otherwise the item is set to disabled and not to display.

System Info

System:
    OS: macOS 15.1
    CPU: (16) arm64 Apple M3 Max
    Memory: 3.35 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.9.0 - /opt/homebrew/anaconda3/envs/base/bin/node
    npm: 10.1.0 - /opt/homebrew/anaconda3/envs/base/bin/npm
  Browsers:
    Chrome: 126.0.6478.127
    Chrome Canary: 132.0.6821.0
    Safari: 18.1
  npmPackages:
    @vueuse/core: ^10.11.0 => 10.11.0 
    radix-vue: ^1.6.2 => 1.8.3 
    shadcn-vue: ^0.10.3 => 0.10.5 
    vue: ^3.4.23 => 3.4.27

Contributes

sadeghbarati commented 6 days ago

Hi, use nuxt.new to create a server-side playground please