flux icon indicating copy to clipboard operation
flux copied to clipboard

Question: Why remove the AppDispatcher.handleAction

Open joeyhipolito opened this issue 11 years ago • 2 comments

Why remove the AppDispatcher.handleAction, was it because it isn't need in TodoApp example? Or it is entirely not needed in most applications? Or we need it in some real life use cases because:

We also add a handleAction helper method to our Dispatcher instance, so that we can identify where this action came from. -- scotch.io tut

joeyhipolito avatar Jan 08 '15 19:01 joeyhipolito

The handleServerAction and handleViewAction wrappers around Dispatcher.dispatch() were unnecessary cruft that came over from a couple of applications we built at Facebook. If one needs to determine whether a particular action came from the server or the view, a property can be added to the action to denote the origin.

It's a bit cleaner to have the dispatcher's payload be synonymous with the action.

fisherwebdev avatar Jan 08 '15 22:01 fisherwebdev

For those wondering what the above means: just replace 'dispatcher.handleAction()' calls with 'dispatcher.dispatch()' and it will work.

developer94404 avatar Feb 13 '17 22:02 developer94404