Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[supermassive] Deal with conditional resolving AOT #193

Open
alloy opened this issue Jul 8, 2022 · 1 comment
Open

[supermassive] Deal with conditional resolving AOT #193

alloy opened this issue Jul 8, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@alloy
Copy link
Member

alloy commented Jul 8, 2022

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)
  }
}
@alloy alloy added the enhancement New feature or request label Jul 8, 2022
@alloy
Copy link
Member Author

alloy commented Jul 8, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant