-
Notifications
You must be signed in to change notification settings - Fork 18
Replace custom server action guards with next-safe-action #11
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
Replace custom server action guards with next-safe-action #11
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
The name of PR is misguiding, it isn't only about server action guards, there are also changes unrelated to that. This makes it very hard to review
fair, 90% is about the server action guards. the problem is more that the state management in the component had to be rewritten as soon as the action implementation changed. so it was big from the beginning |
Replace custom server action guards with next-safe-action
Summary
This PR replaces our custom
guard
abstraction for server actions with thenext-safe-action
library, providing improved type safety, error handling, and client-side state management while reducing maintenance burden.Motivation
Our current approach using custom HOF-based guards worked but required ongoing maintenance and didn't provide optimal client-side state handling. The
next-safe-action
library offers a more robust, well-maintained alternative with additional features:Changes
Server-side
authActionClient
that extends the base client with auth checks.metadata()
to all actions for improved observabilityguard
tonext-safe-action
patternClient-side
startTransition
and tanstack query mutation hooks withuseAction
hookOther Issues fixed