Giter VIP home page Giter VIP logo

Comments (6)

mjk-coding avatar mjk-coding commented on June 9, 2024

This is an intended behavior.

Query results by default are structurally shared to detect if data has actually changed and if not, the data reference remains unchanged...

You can find the complete explanation here: Important Defaults
Or here: Structural sharing

from query.

TkDodo avatar TkDodo commented on June 9, 2024

indeed, you can see in the devtools that the dataUpdatedAt and dataUpdateCount always increase. However, if data doesn't really "change", you'll get back the referentially same data, so your effects won't trigger unnecessarily. That is the structuralSharing feature, which you can turn off with structuralSharing: false.

from query.

rajzik avatar rajzik commented on June 9, 2024

@TkDodo in our project when we invalidate query the data is changed on backend and refetched, this doesn't trigger useefect with data, is this intended?

from query.

TkDodo avatar TkDodo commented on June 9, 2024

If nothing changed in data then yes

from query.

rajzik avatar rajzik commented on June 9, 2024

The data is changing and effect isn't triggered in my case. What is used to detect changes? @TkDodo

from query.

TkDodo avatar TkDodo commented on June 9, 2024

The data is changing and effect isn't triggered in my case. What is used to detect changes? @TkDodo

then please show an example where data is changing because in your example, it's not.

links to structuralSharing explanations were shared here: #6583 (comment)

from 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.