Giter Club home page Giter Club logo

Comments (6)

kitten avatar kitten commented on May 12, 2024

Can you try whether this is still an issue with 0.3.0-next1 please? You can install it using the β€œnext” tag.

from urql.

garrett-thompson avatar garrett-thompson commented on May 12, 2024

Yea, still doing it on 0.3.0-next1.

When I add if (data) console.log("test"); inside the render prop, then fire the mutation once (via onClick), I see this in the console:

screen shot 2018-05-19 at 2 25 27 pm

Seems a little excessive.

from urql.

kitten avatar kitten commented on May 12, 2024

I think we'd need a reproduction on CodeSandbox to confirm this. There's only two calls to setState as a result of a mutation. Although afterwards a refetch on the query might cause two additional, but separate, rerenders of course.

There's also the case of calling query and mutation inline in your render method. This way you might accidentally trigger a refetch or an update (the latter in the best case scenario), so try to pull that out of your component, if possible, or into an instance variable and see if it improves the situation.

https://github.com/FormidableLabs/urql/blob/master/src/components/client.tsx#L57-L62

from urql.

kitten avatar kitten commented on May 12, 2024

@mellogarrett any update? It'd be great if we could get a CodeSandbox running for this

from urql.

garrett-thompson avatar garrett-thompson commented on May 12, 2024

Hey @kitten I'm sorry, I ended up just using Axios to make graphql requests from componentDidMount rather than on every render via urql's render prop.

from urql.

kitten avatar kitten commented on May 12, 2024

@mellogarrett Alright, since this is not reproducible right now and stale I'll close the issue. Sorry about that, let's see if someone else hits a similar case in the future

from urql.

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.