-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add After dispatch hook and Before transition, rename existing hooks #23
Conversation
I'm open to adding an (My apologies for not responding to this sooner. I'll try to be more responsive going forward :) ) |
Thanks for looking into it! I do agree renaming all of those and adding before before_transition. Do you want all of that in this PR? |
Yes, if you want to, you can go ahead and make the changes on this PR. But if you're not able to do it at the moment, just let me know and I'll see what I can do. |
Sorry for the delay, should be done. I don't think I missed anything. I renamed the consts for hooks to uppercase in IntoStateMachine too as suggested by clippy. |
Isn't this a breaking change? I would think the manifest version should be revised to |
Definitely a breaking change, if you would like to have the version bump in this PR too I am will add that right away, didn't do it because I am not sure how you would like to manage that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you forgot to call M::BEFORE_TRANSITION()
in the transition()
function? :) Other than that everything looks good, just a couple of comments with the wrong name.
Regarding the version bump, you can change it to 0.4.0 for both the statig
and statig_macro
crate.
Co-authored-by: Maxim Deloof <[email protected]>
Co-authored-by: Maxim Deloof <[email protected]>
Co-authored-by: Maxim Deloof <[email protected]>
Thanks! I hope I didn't missing anything, should be fine now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Almost there I think, just a small error in the docs left. You will also have to bump the version of the statig_macro
dependency in /statig/Cargo.toml
.
[dependencies]
-statig_macro = { path = "../macro", version = "0.3.0", optional = true }
+statig_macro = { path = "../macro", version = "0.4.0", optional = true }
Oh, my bad! Sorry, I should catch that. Should be fine now :) |
No problem ;) Thanks again for your work! |
Although on_dispatch and on_transition hook are intend to be used for loging in some cases it can be useful to abuse them to have a global even handler that stores some filtered events in self. For that case it sometimes makes sense to be able to store something in self after a state handler is called to for example use it for storing previous values that can be used when a new value comes in to compare too.