Coder Social home page Coder Social logo

Comments (5)

TkDodo avatar TkDodo commented on May 19, 2024

I think when both are enabled, the parent initiates the fetching. Now, the child initiates the fetching and it kinda depends on our batching if there is going to be another re-render or not. You can adapt batching functionality here:

https://tanstack.com/query/v5/docs/reference/notifyManager#notifymanagersetscheduler

from react-query.

burakgormek avatar burakgormek commented on May 19, 2024

Thanks for the fast response. I see, for enabled scenario, that makes sense but...

Doesn't the parent have to do nothing if it's not enabled? Although nothing is changed in destructed values. (isError just an example)

from react-query.

TkDodo avatar TkDodo commented on May 19, 2024

yeah there's something "off" here since isError didn't change, there shouldn't be a re-render for this observer. Would you like to look into it ?

from react-query.

burakgormek avatar burakgormek commented on May 19, 2024

I did a little look to find what cause a re-render but not found anything yet. Its not easy to understand the internals for the first look (for me).

I want to look deeper into it, but our project deadline does not allow it :/

from react-query.

Mrityunjay-Palled avatar Mrityunjay-Palled commented on May 19, 2024

Try to pass enabled prop to the child component,

  1. In Parent Component
    pass the enabled prop down to the child component enabled={isError}

2)In Child Component
enabled: enabled, // Set enabled based on the parent's status

ensuring that the child's useQuery hook represents the parent's enabled status

from react-query.

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.