Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All filters are disabled if the first field in the select has disableListFilter=true #10110

Open
tylkomat opened this issue Dec 20, 2024 · 1 comment · May be fixed by #10112
Open

All filters are disabled if the first field in the select has disableListFilter=true #10110

tylkomat opened this issue Dec 20, 2024 · 1 comment · May be fixed by #10112
Labels
status: needs-triage Possible bug which hasn't been reproduced yet

Comments

@tylkomat
Copy link

Describe the Bug

In the reproduction the User has to new fields toDisable and other. When toDisable has disableListFilter set to true the whole filter is disabled, although other should be available for selection.

Link to the code that reproduces this issue

https://github.com/tylkomat/disabled-list-filter-bug

Reproduction Steps

  1. visit User collection
  2. add Filter
  3. All fields are disabled
  4. Edit Users.ts and set disableListFilter to false
  5. toDisable and other fields are available for filter selection

Which area(s) are affected? (Select all that apply)

area: ui

Environment Info

Binaries:
  Node: 20.12.2
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  payload: 3.9.0
  next: 15.0.4
  @payloadcms/db-mongodb: 3.9.0
  @payloadcms/graphql: 3.9.0
  @payloadcms/next/utilities: 3.9.0
  @payloadcms/richtext-lexical: 3.9.0
  @payloadcms/translations: 3.9.0
  @payloadcms/ui/shared: 3.9.0
  react: 19.0.0
  react-dom: 19.0.0
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 15125
  Available CPU cores: 12
@tylkomat tylkomat added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction labels Dec 20, 2024
@akhrarovsaid
Copy link
Contributor

akhrarovsaid commented Dec 20, 2024

I think this happens because the WhereBuilder / Condition components add, by default, the first available collection to the filter. In your case, that just so happens to be one where disableListFilter is true, this procs that condition component to consider that select disabled and will not allow you to change it.

Solution here would either be to remove disabling of the initial collection select, or to prevent adding the initial collection to the where builder if it has disableListFilter set to true (I like this approach better).

I can look into this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs-triage Possible bug which hasn't been reproduced yet
Projects
None yet
2 participants