Skip to content

fix(relations): gracefully skip undefined where filter and fields in RQB v2 - #6185

Open
webdevsamran wants to merge 1 commit into
drizzle-team:rc5from
webdevsamran:fix/rqb-v2-skip-undefined-where-filter
Open

fix(relations): gracefully skip undefined where filter and fields in RQB v2#6185
webdevsamran wants to merge 1 commit into
drizzle-team:rc5from
webdevsamran:fix/rqb-v2-skip-undefined-where-filter

Conversation

@webdevsamran

Copy link
Copy Markdown

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant