GithubHelp home page GithubHelp logo

Comments (7)

kyldvs avatar kyldvs commented on April 27, 2024

This is hard to debug without seeing the code to understand your issue, or a minimal repro. One thing to make sure you are doing is exporting an instantiated version of a store and not the store's class, like this in the examples: https://github.com/facebook/flux/blob/master/examples/flux-todomvc/src/data/TodoStore.js#L67

from flux.

bluebeag avatar bluebeag commented on April 27, 2024

Yes, that's what I'm doing. It's not behaving like a Singleton.

WTStore.js contain: export default new WTStore();

DataView.js (and Login.js) contain: import WTStore from '../stores/WTStore';

from flux.

kyldvs avatar kyldvs commented on April 27, 2024

If you are doing that then I don't have a guess at what else might be wrong without seeing a more complete example. Can you repro the same issues in one of the examples? Or provide more code/minimal repro?

from flux.

bluebeag avatar bluebeag commented on April 27, 2024

I'll work on getting a simplified version that reproduces the behavior. Am I correct in that it shouldn't create a new instance of the store? Thank you.

from flux.

kyldvs avatar kyldvs commented on April 27, 2024

I believe so, there should typically only be one instance of any given store. They should act like singletons.

from flux.

bluebeag avatar bluebeag commented on April 27, 2024

There is one instance at a given time. The problem is the store state is wiped when the second component references the store.

from flux.

kyldvs avatar kyldvs commented on April 27, 2024

Without an example of the bug it's going to be hard for me to help you further. I've not heard of this happening before other than at times where someone is accidentally re-instantiating new instances of the store rather than it being used as a singleton.

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.