Giter Site home page Giter Site logo

Comments (3)

RohovDmytro avatar RohovDmytro commented on June 1, 2024 1

@ryanashcraft thanks a lot. I'll think a little bit more.

@MrNice this sounds oversimplified, but this one I totally get it :)

from redux-query.

ryanashcraft avatar ryanashcraft commented on June 1, 2024

Thanks for the kinds words. 😊 Yeah I admit this is confusing and there's things to be done here to make it less so – from docs/runtime warnings/different behaviors.

Let me quickly outline a few of the motivations behind the differences:

  • every "entities" collection are safe boundaries for this problem. simultaneous requests for different entities should never be a problem.
  • requests should be non-destructive, therefore it's OK to let the latest request to complete "win" because order shouldn't matter. request update functions should be written in a safe way that behaves correctly regardless of the order in which the requests return.
  • mutations are destructive, therefore you run into problems when you issue multiple mutations for the same entity. redux-query doesn't have a built-in mechanism for handling conflicts when this happens. it actually discourages this behavior (in a horrible, silent way) by using the same entities state you had when you dispatched mutateAsync. one possible solution we've discussed for this problem is to queue mutations based on the entities that they update.

Let me know if you have any questions or if that doesn't make sense. I do plan on addressing some of these aforementioned problems in the future…

from redux-query.

MrNice avatar MrNice commented on June 1, 2024

@rogovdm I think about requests as data reads from network and mutations as data writes to network, similarly to action Creators being state writes and selectors being state reads. I hope that helps!

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