Support for local typeDefs and resolvers
See original GitHub issueI’m using a local GraphQL schema with client-only queries to achieve local state management using Apollo.
Since ApolloClient gets initialized by Offix itself, and there is no way to provide additional typeDefs and resolver options in the config I’m wondering if this is even possible using Offix?
Here is an example of the options I need that can’t be offered to Offix’ OfflineClient:
const apolloClient = new ApolloClient({
typeDefs,
resolvers,
});
Ideally, it should be possible to pass a client initializer function which allows you to create an ApolloClient from outside OfflineClient.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Local resolvers - Apollo GraphQL Docs
Apollo Client supports asynchronous local resolver functions. These functions can either be async functions or ordinary functions that return a Promise .
Read more >Using TypeGraphQL to generate typedefs and resolvers for ...
I would like to use TypeGraphQL with Apollo local state in browser. How can I use TypeGraphQL to generate typedefs and resolvers for...
Read more >Support for client side resolvers (apollo-link-state) #197 - GitHub
I haven't found it useful as apollo-link-state has no typedef, so declaring graphql types makes no sense here.
Read more >Schema Merging – GraphQL Tools
This is useful for building a single local service schema from many ... GraphQLSchema objects together with extra typeDefs and resolvers .
Read more >GraphQL Schemas, TypeDefs & Resolvers - Prisma
GraphQL has a clear separation of structure and behaviour. The structure of a GraphQL server is — as we just discussed — its...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks for picking this up so early, the new changes look awesome!
Hey @wilmervanheerde so sorry for taking this long to get back to you. Your issue actually motivated us to go ahead and do some work that we’ve been planning on doing for a long time.
Previously, the
OfflineClientclass was a wrapper that would internally create anApolloClientand then you could get access to it afterwards. The flow looked something like this.And of course, your issue was that you wanted to pass some additional options into the resulting ApolloClient but our API didn’t provide a way to do that.
Well, we’ve refactored things so now we export a class called
ApolloOfflineClientwhich directlyextendsApolloClient. Now you can pass in all of the Apollo Client options you’d like.The way you initialise things is slightly different, mainly, you need to pass an
ApolloLinkthat can talk to your GraphQL server. Check out the example code below.We haven’t officially released it yet and we’re still working on some docs updates but you should be able to try out our dev release with
npm install offix-client@0.11.0-dev3. We’d love to get your feedback to see if it resolves your problem (and hopefully doesn’t create any new ones) before we cut an official release. Thanks!