-
Notifications
You must be signed in to change notification settings - Fork 48
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 ↗︎
|
jakubno
left a comment
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
guardabstraction for server actions with thenext-safe-actionlibrary, 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-actionlibrary offers a more robust, well-maintained alternative with additional features:Changes
Server-side
authActionClientthat extends the base client with auth checks.metadata()to all actions for improved observabilityguardtonext-safe-actionpatternClient-side
startTransitionand tanstack query mutation hooks withuseActionhookOther Issues fixed