-
-
Notifications
You must be signed in to change notification settings - Fork 36
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 onExecute callback #22
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Add a new callback for the useAction hook onExecute
Add a new callback for the useOptimisticAction hook onExecute
ae885b3
to
1687fcd
Compare
Awesome work, this will be a nice addition to the lib! Just one thing though, can you please restore the original README_v2.md file and update README.md instead? v2 is for the old 2.x.x version of next-safe-action, README.md is for version 3 (the current one). Thank you very much! |
1687fcd
to
b69b6e3
Compare
Sure thing @TheEdoRan, I've updated the correct readme! |
🎉 This PR is included in version 3.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 4.0.0-experimental.8 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Purpose
Inspired by react-query's
onMutate
I added the callbackonExecute
to both hooksuseAction
anduseOptimisticAction
. This callback is useful to run code before any action and avoid creating an extra helper function. The input can be accessed aswell in order to perform different actions based on itBefore
After