react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

@apollo/client v4 and ra-data-graphql compatibility

Open ThHareau opened this issue 2 months ago • 1 comments

I am trying to use buildGraphQLProvider with @apollo/client 4.0.6 which doesn't seem to be compatible with ra-data-graphql.

Here is my snippet:

const client = new ApolloClient({
  cache: new InMemoryCache(),
  link: new HttpLink(),
});

const buildQuery = () => () => {
  return {
    query: gql``,
    variables: {},
    parseResponse: (response: unknown) => response,
  };
};

buildGraphQLProvider({ client, buildQuery });

with @apollo/client in version 4.0.6 and ra-data-graphql in version 5.11.4.

I'm having the following issue:

error TS2739: Type 'ApolloClient' is missing the following properties from type 'ApolloClient<unknown>': typeDefs, addResolvers, setResolvers, getResolvers, setLocalStateFragmentMatcher

This happens because ra-data-graphql is expecting an ApolloClient v3 whereas I provide an ApolloClient v4.

Are you planning to support version 4 from ApolloClient ?

ThHareau avatar Sep 26 '25 13:09 ThHareau

Hi,

That's low priority for us and we must keep the support for v3. We would gladly accept a PR that manages that though

djhi avatar Sep 26 '25 14:09 djhi