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

Closed
tylkomat opened this issue Dec 20, 2024 · 3 comments · Fixed by #10267
Closed
Assignees

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.

Copy link
Contributor

github-actions bot commented Jan 1, 2025

This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 1, 2025
Copy link
Contributor

github-actions bot commented Jan 2, 2025

🚀 This is included in version v3.13.0

@github-actions github-actions bot unlocked this conversation Jan 2, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jan 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.