[wip] fix undefined filters in Drizzle connections - #1647
[wip] fix undefined filters in Drizzle connections#1647williamrobertson13 wants to merge 2 commits into
Conversation
|
@williamrobertson13 is attempting to deploy a commit to the Michael Hayes' projects Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: 2f801f3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@pothos/core
@pothos/plugin-add-graphql
@pothos/plugin-complexity
@pothos/plugin-dataloader
@pothos/plugin-directives
@pothos/plugin-drizzle
@pothos/plugin-errors
@pothos/plugin-example
@pothos/plugin-federation
@pothos/plugin-grafast
@pothos/plugin-mocks
@pothos/plugin-prisma
@pothos/plugin-prisma-utils
@pothos/plugin-relay
@pothos/plugin-scope-auth
@pothos/plugin-simple-objects
@pothos/plugin-smart-subscriptions
@pothos/plugin-sub-graph
@pothos/plugin-tracing
@pothos/plugin-validation
@pothos/plugin-with-input
@pothos/plugin-zod
@pothos/tracing-newrelic
@pothos/tracing-opentelemetry
@pothos/tracing-sentry
@pothos/tracing-xray
commit: |
There was a problem hiding this comment.
Pull request overview
This PR updates @pothos/plugin-drizzle connection query generation to avoid emitting where: undefined in Drizzle relational queries, improving compatibility with stricter Drizzle 1.0.0-rc.5 filtering behavior. It also adds regression tests for both root and nested connection shapes and includes a patch changeset for release.
Changes:
- Omit
wherefrom generated connection query objects when no filter clauses exist. - Ensure combined
wherelogic for connection + user-provided query is only included when defined. - Add regression tests (root
drizzleConnectionand nestedrelatedConnection) plus a patch changeset.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/plugin-drizzle/src/utils/cursors.ts | Avoids generating where: undefined by conditionally adding where only when a filter exists. |
| packages/plugin-drizzle/tests/drizzle-connections.test.ts | Adds a regression assertion (via spy) that root connection queries omit where when undefined. |
| packages/plugin-drizzle/tests/related-connection.test.ts | Adds a regression assertion (via spy) that nested related connection queries omit where when undefined. |
| .changeset/quiet-ravens-filter.md | Adds a patch changeset describing the compatibility fix for strict Drizzle relational filters. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| }); | ||
|
|
||
| expect(findMany.mock.calls[0][0]).not.toHaveProperty('where'); |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
closing this until RC 5 gets released for real |
Summary
wherefrom generated Drizzle connection queries when there is no filterdrizzleConnectionand nestedrelatedConnectionquery shapes@pothos/plugin-drizzleWhy
Drizzle
1.0.0-rc.5-169397brejects an explicitly undefined relational filter with:Connection queries without a user filter or cursor currently include
where: undefined. Omitting the optional property preserves existing behavior on earlier Drizzle versions and satisfies the stricter rc.5 contract.Validation
drizzle-orm@1.0.0-rc.2: 90/90 plugin tests passdrizzle-orm@1.0.0-rc.4: 90/90 plugin tests passdrizzle-orm@1.0.0-rc.5-169397b: 90/90 plugin tests passpnpm --filter @pothos/plugin-drizzle typepnpm --filter @pothos/plugin-drizzle build