Giter VIP home page Giter VIP logo

Comments (8)

HofmannZ avatar HofmannZ commented on May 18, 2024 1

Lets do that, I’ll start on a PR later today. We have to setup some test to track the performance impact on the queries. ✌🏼

from graphql-flutter.

ened avatar ened commented on May 18, 2024 1

@HofmannZ awesome! I'm on holiday right now 🍷🍷 and will check once back to desk.

from graphql-flutter.

HofmannZ avatar HofmannZ commented on May 18, 2024

@ened Thanks for the suggestion. @eusdima I think we discussed this internally.

Both solutions don't seem ideal. Providing the client with each query or mutation is too cumbersome. And a global client variable is not useful if you might want connect to multiple endpoints.

Instead I propose to create a GraphqlProvider widget that takes a client as a param, and exposes it to all its children trough the context. This would mimic the behaviour of the ApolloProvider

What do you think?

from graphql-flutter.

eusdima avatar eusdima commented on May 18, 2024

Creating a provider and passing client as context seems good, but you will not be able to use the client outside of the provider so maybe support both: GraphqlProvider and the old way.

We have to do performance measurement to make sure that the memory and cpu usage are not higher after switching to the GraphqlProvider.

So should we keep both or just GraphqlProvider?

from graphql-flutter.

HofmannZ avatar HofmannZ commented on May 18, 2024

Well you can always declare the client somewhere in main.dart then pass that client to the GraphqlProvider. Now you can still use the client variable directly as needed.

We can also use ApolloConsumer to acces the compete client within the context tree.

from graphql-flutter.

ened avatar ened commented on May 18, 2024

GraphqlProvider & GraphqlConsumer seem to be the most flexible. People could still put the client in a global variable, but TBH that seemed like a stop-over solution anyway.

I do not understand how this could impact performance in a substantial way?

from graphql-flutter.

HofmannZ avatar HofmannZ commented on May 18, 2024

👆🏼 Early feedback is much appreciated

from graphql-flutter.

HofmannZ avatar HofmannZ commented on May 18, 2024

@ened,
I just finished PR #24, it implements the GraphqlProvider & GraphqlConsumer. I though you might want to have a look and give some feedback, since you brought the issue to light.

from graphql-flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.