Is it an anti-pattern that an action use something like store.get() ? I'm not sure this is a good idea to do that
Asked
Active
Viewed 183 times
0
-
I guess it can but it makes the action coupled to that one store. If you have one store then it might be okay but otherwise no. – Henrik Andersson Sep 17 '15 at 04:51
-
@FrançoisRichard try to post simplified/anonymized examples of what happens in your app. Maybe someone'll suggest another way to do the same – VB_ Sep 17 '15 at 14:28
1 Answers
3
Yes, its a bad idea to call stores
from actions
. Only place where stores
should be called is in views
. For the simple reason that it defies the idea of uni-directional data flow.
It should always be Views -> Action -> Dispatcher -> Stores -> Views
and where as in your case it would be-
Views -> Action -> Dispatcher -> Stores -> Views
^ |
* <- <- <- <-*
which is obviously not uni-directional.

Prashant Abhishek
- 116
- 5