apollo-client: How to get inverse relation from cache?

I have a graphql query response of the shape

{
  table {
    id
    legs {
      id
    }
  }

This normalizes to table and leg entries in my InMemoryCache.

But then if my application retrieves a leg from cache and needs to know the corresponding table, how would I find this?

The two ideas I had are

  • adding a table prop to each leg when the query response comes in – not sure if/how that would work
  • having a suitable cache redirect, but I don’t know how to do this without searching all tables for the leg.

Does apollo provide any features suitable to achieve this inverse lookup?

All topic