If todo functionality and chat functionality are in the same page, how to organize the structure?

42 Views Asked by At

In Flux architecture, how do you manage Store lifecycle?
In a Flux app there should only be one Dispatcher. All data flows through this central hub. Having a singleton Dispatcher allows it to manage all Stores.

The chat example made by facebook has three stores. There are dependancies between each other, but they 'waitFor' others, they are still on the same level.

If there is also a todo functionality on the page, do we add todo store to the same dispatcher, let it be at same level with chat stores? It looks like a mess for me.

How to handle this problem?

1

There are 1 best solutions below

0
On

If there is also a todo functionality on the page, do we add todo store to the same dispatcher, let it be at same level with chat stores?

Yeah, that's the main idea. The main idea of Flux ideology is that there is a unidirectional flow going through one and single dispatcher. This way we can guarantee that there are now cascading updates and that everything happens strictly sequentially.

Why do you think that having to dispatch action through different dispatchers would make things easier?