1

I have a nested object to return. The first screen is the network response, the second one is the actual JS object from Apollo:

network response

actual js object

The query is simple:

query{
  order(_id:"5fe71dd045491e1cf0d2b58c"){
    _id
    orderId
    manager{
      _id
      firstName
      lastName
      fullName
      email
    }
    }
}

Any idea what can be the issue? I have tried without caching, like fetchPolicy: "network-only", but it didn't help. Feel like need to work with vanilla XmlRequest instead.

My client is "@apollo/client": "^3.2.1".

import {
  ApolloClient,
  InMemoryCache,
  createHttpLink,
  NormalizedCacheObject,
} from "@apollo/client";

const { REACT_APP_API_URL } = process.env;
const link = createHttpLink({
  uri: REACT_APP_API_URL,
  credentials: "include",
});
const s: any = {
  cache: new InMemoryCache({
    typePolicies: {
      Locations: {
        keyFields: [],
      },
    },
  }),
  link,
};
const client: ApolloClient<NormalizedCacheObject> = new ApolloClient(s);
export { client };
Simon Pasku
  • 539
  • 2
  • 4
  • 17
  • i just tried with ``` fetchPolicy: "no-cache"; const result = yield client.query({ query: FetchOrder, variables: { _id, }, fetchPolicy: "no-cache", }); ``` and seems that was helpfull. But i got more confused. I want to use cache(what else Apollo to use) - but quick debug i see caching - no requests are made on same query from different component – Simon Pasku Dec 27 '20 at 08:34

0 Answers0