-
Notifications
You must be signed in to change notification settings - Fork 46
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
Debug flag for the dispatcher #27
Comments
An alternate you might consider trying that we've had success with is simply creating a DebugStore whose only responsibility is to log payloads. |
@balanceiskey indeed, that could be a good approach... However, I think adding the second suggested piece of code would be better. |
@ferrannp Yeah, this piece of code won't hurt anyone and is quite useful +1 |
@balanceiskey @ferrannp I'll be reviewing this this weekend. |
I'm not sure if implicitly including a debug mode, like example 2 is really desired as a core feature. That said, does anyone have any ideas around passing a debug flag? I'm having difficulty creating a global debug flag with browserify. |
Perhaps attach a debug flag to the McFly instance? Webpack has good functionality for global flags but a modular framework should definitely not assume a build process, also, it's nice to support people who like to add their scripts individually to an html file! (without globals) I find the debug logging store to be the most flexible solution here! |
I've been just dropping this snippet in my main entry points:
I like being able to enable/disable this in the console while the application is running. @kenwheeler: Browserify gives you access to |
As it is written here:
http://www.code-experience.com/async-requests-with-react-js-and-flux-revisited/
There should be only one channel for all state changes: The Dispatcher. This makes debugging easy because it just requires a single console.log in the dispatcher to observe every single state change trigger.
I am missing this "console.log" when the Dispatcher is using "dispatch" so it's very easy and fast to see every time that some action has been dispatched (and I don't need console.log in all the Stores).
Will you be able to add some debug flag to set this console.log on or off? Something like:
Or maybe like React does:
Thanks in advance!
The text was updated successfully, but these errors were encountered: