marmelab / marmelab/react-admin

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

Open
#10,971 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
26.9k
Forks
5.5k
Avg merge
2d 3h
Merged PRs (30d)
19

Description

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 ?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the ra-data-graphql buildGraphQLProvider entry point and review the ApolloClient type it accepts. Compare that requirement with the @apollo/client 4.0.6 client shown in the issue; done means the example type-checks with Apollo Client v4 while preserving the existing provider behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.