Draft
Fix drizzleField to prevent unnecessary ModelLoader queries in mutations#1583
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: hayes <816527+hayes@users.noreply.github.com>
…ield Co-authored-by: hayes <816527+hayes@users.noreply.github.com>
Co-authored-by: hayes <816527+hayes@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix mapping in Mutation field to prevent unnecessary re-query
Fix drizzleField to prevent unnecessary ModelLoader queries in mutations
Dec 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
drizzleFieldwithin mutations caused unnecessary re-queries via ModelLoader even when resolvers returned complete data. This was particularly problematic for delete operations attempting to fetch already-deleted records.Root Cause
queryFromInfosets loader mappings that prevent ModelLoader from re-querying. It was only called when resolvers explicitly invoked thequeryparameter. Mutations using.returning()don't need the query function since they return data directly:This resulted in:
Changes
Modified
drizzleFieldanddrizzleFieldWithInputto:queryFromInfoafter resolver if query function was not invokedThis ensures mappings are set regardless of whether the resolver uses the query function, while avoiding duplicate calls when it does.
Test Coverage
Added
mutation-field-mapping.test.tsvalidating:Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
checkpoint.prisma.io/usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/pothos/pothos/node_modules/.pnpm/prisma@7.1.0_@types+react@19.2.7_better-sqlite3@12.5.0_react-dom@19.2.3_react@19.2.3__react@19.2.3_typescript@5.9.3/node_modules/prisma/build/child {"product":"prisma","version":"7.1.0","cli_install_type":"local","information":"","local_timestamp":"2025-12-21T09:26:13Z","project_hash":"344f9b9a","cli_path":"/home/REDACTED/work/pothos/pothos/packages/plugin-prisma/node_modules/prisma/build/index.js","cl sh .1/b�� swc src -d lib --config-file ../../.swcrc -C module.type=commonjs --strip-leading-paths node federation/node_modules/.bin/node s --strip-leadinnode node n/node node .1/b�� son node -r @swc-node/register ../../scripts/esm--config-file -d tools/pnpm/10.15.1_tmp_3499/node_modules/pnpm/dist/node-gyp-bin/node --config-file ../../.swcrc -C node(dns block)/usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/pothos/pothos/node_modules/.pnpm/prisma@7.1.0_@types+react@19.2.7_better-sqlite3@12.5.0_react-dom@19.2.3_react@19.2.3__react@19.2.3_typescript@5.9.3/node_modules/prisma/build/child {"product":"prisma","version":"7.1.0","cli_install_type":"local","information":"","local_timestamp":"2025-12-21T09:26:15Z","project_hash":"33bcc4ae","cli_path":"/home/REDACTED/work/pothos/pothos/packages/plugin-prisma/node_modules/prisma/build/index.js","cl node k/po�� -node/register ../../scripts/esm-transformer.ts sh _modules/pnpm/dist/node-gyp-bin/node s --strip-leadinsh sh node node .1/b�� && swc src -d esm --config-file ../../.swcrc -C module.type=es6--config-file node errors/node_modules/.bin/sh sm:extensions sh node sh(dns block)/usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/pothos/pothos/node_modules/.pnpm/prisma@7.1.0_@types+react@19.2.7_better-sqlite3@12.5.0_react-dom@19.2.3_react@19.2.3__react@19.2.3_typescript@5.9.3/node_modules/prisma/build/child {"product":"prisma","version":"7.1.0","cli_install_type":"local","information":"","local_timestamp":"2025-12-21T09:26:25Z","project_hash":"5d274ca5","cli_path":"/home/REDACTED/work/pothos/pothos/packages/plugin-with-input/node_modules/prisma/build/index.js" sh .1/b�� son node -r @swc-node/register ../../scripts/esm-transformer.ts sh _modules/pnpm/dist/node-gyp-bin/node sm:extensions node node node .1/b�� build:esm node les/.bin/sh ../.swcrc -C modsh build /home/REDACTED/.coTS_NODE_PROJECT=../../tsconfig.json node -r @swc-node/register ../../scripts/esm-transformer.ts sh(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Mutationfield, causing an unnecessary ModelLoader to run. #1582💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.