Skip to content

Commit

Permalink
refactor(experimental): graphql: patch onlyFieldsRequested for Grap…
Browse files Browse the repository at this point in the history
…hQL default fields (#2812)
  • Loading branch information
buffalojoec committed Jun 14, 2024
1 parent 7efea19 commit 627fe29
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/rpc-graphql/src/resolvers/resolve-info/visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ export function onlyFieldsRequested(fieldNames: string[], info: GraphQLResolveIn
function checkFieldsWithVisitor(root: RootNode | null) {
injectableRootVisitor(info, root, {
fieldNodeOperation(_info, node) {
// Ignore the GraphQL default fields.
if (node.name.value === '__id' || node.name.value === '__typename') {
return;
}
onlyFieldsRequested = fieldNames.includes(node.name.value);
if (!onlyFieldsRequested) {
return BREAK;
Expand Down

0 comments on commit 627fe29

Please sign in to comment.