N
N
nos43ratu2021-05-07 13:48:57
React
nos43ratu, 2021-05-07 13:48:57

How to save cache from different queries that have the same parent field in ApolloClient3?

I have two requests

query ProjectListQuery {
  auth {
    projects {
      list {
        id
        name
      }
    }
  }
}

and
query VulnerabilityListQuery {
  auth {
    vulnerabilities {
      list {
        id
        name
      }
    }
  }
}

and it turns out that Apollo cannot separate them and throws a message into the console.
60951927d73d5283324667.png
It turns out that the second request overwrites the first one and because of this, Apollo sends the first request again. I don't understand how to set up typePolicies in InMemoryCache to cache these queries. Or you still have to give id vulnerabilities and projects in the apish.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question