New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Promise in context.dispatch #29
Comments
Are you using fetchr with the fetchr plugin to register your services? |
No, I am just trying to use a generic service that returns a promise. |
If the server does send a response, but with an empty state, it may be a problem with the contexts you are using. If it doesn't send any response, I'd check why the I've been fighting with both cases until I got how fluxible works. Trying to isolate the problem did help a lot! |
I figured it out. Basically I was using the flux-routr plugin and firing off my route dependent actions to load the initial data-
But I was calling done instead of letting loadCampaigns call done(). Therefore, the action was immediately returning and react was rendering the view assuming no changes were emitted.
Removing the done() fixed the problem. |
I am not sure if this is a fluxible thing or a React issue, but on my initial server-rendered view, if I have a synchronous method in the action, the data propagates to the store and gets de-hyrdated-
However, if I use a function that returns a promise, then the data never gets propagated and then de-hyrdated into the state.
Is this a problem because of the promise? I am using Koa.js, so I am not sure if the promise is causing the view to be served before the promise is resolved?
The text was updated successfully, but these errors were encountered: