Skip to content

[supermassive] Deal with conditional resolving AOT #193

@alloy

Description

@alloy

If we do AOT compilation of some sort, we can do some of the work that resolvers sometimes do at runtime where they reflect on the request AST to determine what fields are selected and if all data is already available or needs to be fetched from a [remote] I/O bound source.

A contrived example is when only an id field of an object is selected, in which case we wouldn't need to fetch the full user object:

type User {
  id: ID!
  name: String!
}

type Query {
  user(id: ID!): User
}
query {
  user(id: 42) {
    id
  }
}
function userResolver(_source, args, context, info) {
  if (onlyNeedsIdField(info)) {
    return { id: args.id }
  } else {
    return getUser(args.id)
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions