GithubHelp home page GithubHelp logo

Comments (4)

bowd avatar bowd commented on April 26, 2024

I'm not a maintainer, but as far as my understanding of flux goes, server side communication should happen in actions. The result of a server side communication should update the stores, to reflect the server response. Stores should (at least for the most part) be able to update synchronously.

from flux.

sterpe avatar sterpe commented on April 26, 2024

@bogdan-dumitru, this is my understanding too, and I can buy the logic of that, but I also wonder whether the inability to get any browser repaints while stores are digesting becomes problematic as a flux architecture application grows?

@maintainers, any thoughts on this?

from flux.

fisherwebdev avatar fisherwebdev commented on April 26, 2024

Yes, @bogdan-dumitru is correct that the synchronous nature is intentional, and is required if we are to be able to cause the stores to update themselves only after the stores they depend on have been updated.

When communicating with a server, one should split the data flow at the point of creating an action. An example of this can be seen here: https://github.com/facebook/flux/blob/master/examples/flux-chat/js/actions/ChatMessageActionCreators.js#L23-28 -- in this example, we optimistically update the store with the client-side data. Then in the the XHR success or failure callback, you would create another action.

from flux.

fisherwebdev avatar fisherwebdev commented on April 26, 2024

@sterpe I could imagine this scenario if your store logic was computationally expensive, but it's uncommon that the store logic is the bottleneck in performance. I've seen pretty crazy things like dispatches on a requestAnimationFrame cycle, and Flux/React handled them just fine.

One place where I did see some lag was in an initial data load, when the load was quite large. I'm not sure how we eventually improved that, but I'll try to find out and get back to you.

from flux.

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.