jmreidy / fluxy

An implementation of Facebook's Flux architecture
232 stars 19 forks source link

return the result of actions #38

Closed autarc closed 9 years ago

autarc commented 9 years ago

There are some use cases where the promise success/failure of an action should not only invoke stores, but also trigger other handlers based on the original result. Since the dispatcher doesn't return promises directly its added to the Action.js.

jmreidy commented 9 years ago

The dispatcher and actions not returning promises is as per the Flux design. I'm wondering if this same idea can be accomplished by having actions listen for other notifications?

autarc commented 9 years ago

It probably could - but adding an additional listener just to check for the original outcome seems quite an overhead. In my case its used for handling transitions before the actual routing and requesting remote data, so its not necessary that the actual data are returned but mainly the difference of success/failure. Currently the promise always resolves successfully even though the "_FAILED" handler is invoked.

[Edit] After restructuring the code and solving #40 it works with custom listeners. Although a traditional rejection would simplify it - its not necessary after all.