Skip to content

fix relatedConnection totalCount when parent loaded without _count#1610

Merged
hayes merged 4 commits intomainfrom
fix/connection-totalcount-loaded-check
Apr 1, 2026
Merged

fix relatedConnection totalCount when parent loaded without _count#1610
hayes merged 4 commits intomainfrom
fix/connection-totalcount-loaded-check

Conversation

@hayes
Copy link
Copy Markdown
Owner

@hayes hayes commented Apr 1, 2026

The loadedCheck for relatedConnection's totalCountOnly path unconditionally returned true, skipping the loadSelection fallback even when _count was not present on the parent object. This happens when the parent prismaField resolver does not spread query into the Prisma call.

Now loadedCheck verifies _count is actually available before claiming data is loaded, allowing loadSelection to re-fetch with proper _count selections.

Fixes #1609

The loadedCheck for relatedConnection's totalCountOnly path unconditionally
returned true, skipping the loadSelection fallback even when _count was not
present on the parent object. This happens when the parent prismaField
resolver does not spread query into the Prisma call.

Now loadedCheck verifies _count is actually available before claiming data
is loaded, allowing loadSelection to re-fetch with proper _count selections.

Fixes #1609

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pothos Ready Ready Preview, Comment Apr 1, 2026 11:40pm

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 1, 2026

🦋 Changeset detected

Latest commit: 67eca0a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@pothos/plugin-prisma Patch
@pothos-examples/complex-app Patch
@pothos-examples/prisma-federation Patch
@pothos-examples/prisma-relay Patch
@pothos-examples/prisma-smart-subscriptions Patch
@pothos-examples/prisma-subscriptions Patch
@pothos-examples/prisma Patch

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 1, 2026

Open in StackBlitz

@pothos/core

npm i https://pkg.pr.new/@pothos/core@1610

@pothos/plugin-add-graphql

npm i https://pkg.pr.new/@pothos/plugin-add-graphql@1610

@pothos/plugin-complexity

npm i https://pkg.pr.new/@pothos/plugin-complexity@1610

@pothos/plugin-dataloader

npm i https://pkg.pr.new/@pothos/plugin-dataloader@1610

@pothos/plugin-directives

npm i https://pkg.pr.new/@pothos/plugin-directives@1610

@pothos/plugin-drizzle

npm i https://pkg.pr.new/@pothos/plugin-drizzle@1610

@pothos/plugin-errors

npm i https://pkg.pr.new/@pothos/plugin-errors@1610

@pothos/plugin-example

npm i https://pkg.pr.new/@pothos/plugin-example@1610

@pothos/plugin-federation

npm i https://pkg.pr.new/@pothos/plugin-federation@1610

@pothos/plugin-grafast

npm i https://pkg.pr.new/@pothos/plugin-grafast@1610

@pothos/plugin-mocks

npm i https://pkg.pr.new/@pothos/plugin-mocks@1610

@pothos/plugin-prisma

npm i https://pkg.pr.new/@pothos/plugin-prisma@1610

@pothos/plugin-prisma-utils

npm i https://pkg.pr.new/@pothos/plugin-prisma-utils@1610

@pothos/plugin-relay

npm i https://pkg.pr.new/@pothos/plugin-relay@1610

@pothos/plugin-scope-auth

npm i https://pkg.pr.new/@pothos/plugin-scope-auth@1610

@pothos/plugin-simple-objects

npm i https://pkg.pr.new/@pothos/plugin-simple-objects@1610

@pothos/plugin-smart-subscriptions

npm i https://pkg.pr.new/@pothos/plugin-smart-subscriptions@1610

@pothos/plugin-sub-graph

npm i https://pkg.pr.new/@pothos/plugin-sub-graph@1610

@pothos/plugin-tracing

npm i https://pkg.pr.new/@pothos/plugin-tracing@1610

@pothos/plugin-validation

npm i https://pkg.pr.new/@pothos/plugin-validation@1610

@pothos/plugin-with-input

npm i https://pkg.pr.new/@pothos/plugin-with-input@1610

@pothos/plugin-zod

npm i https://pkg.pr.new/@pothos/plugin-zod@1610

@pothos/tracing-newrelic

npm i https://pkg.pr.new/@pothos/tracing-newrelic@1610

@pothos/tracing-opentelemetry

npm i https://pkg.pr.new/@pothos/tracing-opentelemetry@1610

@pothos/tracing-sentry

npm i https://pkg.pr.new/@pothos/tracing-sentry@1610

@pothos/tracing-xray

npm i https://pkg.pr.new/@pothos/tracing-xray@1610

commit: 67eca0a

@hayes hayes merged commit d5cd4c6 into main Apr 1, 2026
7 checks passed
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.

prismaConnection with custom totalCount returns null for non-nullable field when connection is empty

1 participant