fix(relations): gracefully skip undefined where filter and fields in RQB v2 - #6185
fix(relations): gracefully skip undefined where filter and fields in RQB v2#6185webdevsamran wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f8af4e6bec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| }); | ||
|
|
||
| // Undefined filter should return undefined | ||
| expect(relationsFilterToSQL(users as any, undefined)).toBeUndefined(); |
There was a problem hiding this comment.
Update the existing undefined-filter expectations
The test suite now has contradictory assertions for the same behavior: this expects relationsFilterToSQL(users, undefined) to return undefined, while tests/rqb-builders.test.ts lines 339–342 still expect that call to throw; that file also retains several related throw expectations for undefined fields, operators, arrays, structural keys, and relation where values. Those tests will deterministically fail under the new implementation, so they need to be updated or removed as part of this semantic change.
Useful? React with 👍 / 👎.
Description
Gracefully skips \undefined\ filter objects and \undefined\ field values in relational queries (RQB v2), rather than throwing an unexpected error. This restores expected behavior when query filters contain conditionally undefined parameters without requiring explicit \EmptyFilter\ imports.
Fixes #6180