Closed maxs15 closed 8 years ago
That's because the post
fires a loading
action immediately.
There are a few things you can do here:
post
from inside the store. Stores are for storing, not for directing traffic.Try firing post
from wherever the user interaction happens.
Thanks Josh ! Problem solved :+1:
I realize that this issue is closed, but I was still confused on the suggestion so I am hoping that someone can clarify. In this case the suggestion is to call post
from the view? So, something like AppSubmitStore.post()
?
Since this function is defined on the store, wouldn't this break the flux pattern which recommends that the view shouldn't touch the Store directly, and instead only call actions?
The flux pattern is don't mutate store state from the view directly but rather initiate everything through actions. Calling this store public method initiates an action so that's ok.
If that bothers you though you could abstract that source method out of the store and put it in a utility function somewhere else.
Thanks, @goatslacker. I did notice that this was an action, but it was weird that the action is defined on the store.
One other question, there is no defer()
method on the functions so I can't call a these as deferred actions. Am I doing something wrong here? Is there another way to do this?
Hi,
I'm having some trouble using the DataSource, for some reason I'm stuck with a:
Uncaught Error: Invariant Violation: Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.
When called my DataSource methodpost
.. Am I missing something ?Here is my code:
Store and source:
Action:
Thanks for the help :)