3

Take these queries:

query Foo(id: ID!) {
  foo(id: $id) {
    id
    bar {
      id
    }
  }
}

query Bar(id: ID!) {
  bar(id: $id) {
    id
  }
}

query Qux(id: ID!) {
  qux: bar(id: $id) {
    id
  }
}

As you can see, qux is an alias for bar.

And now take these cache redirects:

export default {
  Query: {
    bar: (_, args, { getCacheKey }) => getCacheKey({ __typename: "Bar", id: args.id }),
    qux: (_, args, { getCacheKey }) => getCacheKey({ __typename: "Bar", id: args.id }),
  },
};

Does the qux resolver work? I'm sure it works for bar, because I tried it before, but I couldn't tell whether it worked for qux or the data just loaded quickly.

Paul Razvan Berg
  • 16,949
  • 9
  • 76
  • 114

0 Answers0