Skip to content

QueryPresets: UI breaks when you have saved a preset with a not_in filter on a relationship #16614

@mikkelwf

Description

@mikkelwf

Describe the Bug

If you have saved a query preset containing a "not_in" filter on a relationship, clicking the query preset selector results in a blank screen.

The failing method is the toWords in formatLabels.
It expects a string, and it seems like the "string" sent to the method in this specific case in the id of the related collection.

The toWords should in some way guard for non-string input (otherwise the UI blows up).

Also it seems that the label method in the query preset list does not take into account to look up the collection titles. The query filter saved in the db saves the id's only, so the titles of the collections should be looked up.

Please note that the query presets are COMPLETELY UNUSABLE if you get into this problem. I has to delete all the presets in my db to make it usable again.

Link to the code that reproduces this issue

https://github.com/re-cph/payload/tree/20260514_query_preset_notin_error

Reproduction Steps

I have made a simple relation (has many between Posts and Categories.

  • Navigate to the "Posts" list.
  • Apply a new filter: "Categories" -> "is not in" -> "Select one or more categories"
  • The filters apply correctly to the content
  • Create a new preset with the applied filter
  • After successful creation, try to open the preset selection list
  • The UI blows up and the screen is blank (or showing the error in development)

Which area(s) are affected?

area: ui

Environment Info

Binaries:
  Node: 22.17.0
  npm: 10.9.2
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  payload: 3.84.1
  next: 15.5.15
  @payloadcms/db-postgres: 3.84.1
  @payloadcms/drizzle: 3.84.1
  @payloadcms/email-nodemailer: 3.84.1
  @payloadcms/graphql: 3.84.1
  @payloadcms/next/utilities: 3.84.1
  @payloadcms/plugin-import-export: 3.84.1
  @payloadcms/richtext-lexical: 3.84.1
  @payloadcms/translations: 3.84.1
  @payloadcms/ui/shared: 3.84.1
  react: 19.1.1
  react-dom: 19.1.1
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:40 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 8

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions