Skip to content

fix(ui): prevent query preset crash for relationship not_in filters#16625

Open
sisodiaumang wants to merge 2 commits into
payloadcms:mainfrom
sisodiaumang:fix-query-preset-not-in-crash
Open

fix(ui): prevent query preset crash for relationship not_in filters#16625
sisodiaumang wants to merge 2 commits into
payloadcms:mainfrom
sisodiaumang:fix-query-preset-not-in-crash

Conversation

@sisodiaumang

@sisodiaumang sisodiaumang commented May 14, 2026

Copy link
Copy Markdown

What?

Fixes a runtime crash when rendering query presets containing relationship not_in filters.

The issue occurred in:

packages/ui/src/elements/QueryPresets/cells/WhereCell/index.tsx

The WhereCell component passed non-string array values into toWords, which expects a string and internally calls .trim().

This caused the query preset selector UI to crash with:

notNullString.trim is not a function

Why?

Relationship not_in filters can contain non-string values inside the filter array.

These values were passed directly into toWords, which assumes string input and crashes when .trim() is called on unsupported types.

This issue made query presets unusable after saving affected filters.

How?

Safely stringify array values before passing them into toWords.

Updated:

value.map((val) => toWords(val))

to:

value.map((val) => toWords(String(val)))

This prevents the runtime crash while preserving existing behavior.

Fixes #16614

@sisodiaumang sisodiaumang force-pushed the fix-query-preset-not-in-crash branch from b2c510c to a768ca3 Compare May 14, 2026 18:22
@github-actions github-actions Bot added the stale label Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants