Closed ludwigbacklund closed 1 month ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
next-safe-action-example-app | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Mar 18, 2024 11:04pm |
next-safe-action-website | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Mar 18, 2024 11:04pm |
Version 7 will include a much more powerful middleware system, kinda like the tRPC one. It should also cover all the use cases described in this PR. Please let me know what you think about it, thank you! Discussion here: #88
Adds the ability to wrap the execution of server actions by passing in a "wrapExecution" function when creating the safe action client where you can inject things like logging, tracing or performance monitoring. To do these things you also want the name of the action, which I've passed in via the utils object in this PR. This is backwards compatible without breaking changes.
Optimally I think this kind of functionality would best be implemented by changing the current middleware approach to one more similar to what playwright does with their fixtures but that would be a breaking change.
Written blind to get feedback before committing too much time, this has not yet been tested.
Example usage: