I'm setting up a project with React Admin and GraphQL (powered by https://github.com/rmosolgo/graphql-ruby). By the looks of it, I should implement my own data provider.
Looking through the docs, it appears the v3 way to do it is to return an object composed of Promises, eg:
const dataProvider = {
getList: (resource, params) => Promise,
getOne: (resource, params) => Promise,
getMany: (resource, params) => Promise,
getManyReference: (resource, params) => Promise,
create: (resource, params) => Promise,
update: (resource, params) => Promise,
updateMany: (resource, params) => Promise,
delete: (resource, params) => Promise,
deleteMany: (resource, params) => Promise,
};
However, looking at the GraphQL data provider examples, it appears they are using the v2 methodology. I'm unsure if that is because GraphQL data providers have to use the v2 way, or if they simply have not been updated.
Simplistically, I am wondering why not just return an object as above and perform the queries using Apollo within each method and format / return the results.
Am I missing something? This way (I think) would not run the introspection query, so maybe there's a downside to it that I am unaware of.
Any pointers would be appreciated :)