Skip to content

"unsorted" sorting not deterministic #375

Open

Description

@meesvandongen

https://stackblitz.com/~/github.com/meesvandongen/test-shadcn-combobox

https://github.com/meesvandongen/test-shadcn-combobox

When filtering a list of options, and then removing the filter text, the resulting sort order is not the same as the one at the beginning.

The behavior seems to be as follows; given a list of aa - zz, when input is e, and then the input is removed:

DF ... EZ
AA ... DE
FA ... ZZ

I would expect the result with an empty filter to be the same as the initial result (AA ... ZZ)

Activity

  1. gabrielmopereira commented on Jul 29, 2025

    @gabrielmopereira

    Same in here.

  2. oleksandrkovaliuk commented on Nov 28, 2025

    @oleksandrkovaliuk

    Passing a custom filter function from the example shown in the README.md doc solved the problem for me . fyi

    <Command
          filter={(value, search, keywords) => {
            const extendValue = `${value} ${keywords ? keywords.join(" ") : ""}`;
            if (extendValue?.toLowerCase().includes(search?.toLowerCase()))
              return 1;
    
            return 0;
          }}
          {...props}
        >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions