Skip to content

Version 8 #345

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

Open
wants to merge 81 commits into
base: main
Choose a base branch
from
Open

Version 8 #345

wants to merge 81 commits into from

Conversation

TheEdoRan
Copy link
Owner

No description provided.

EskiMojo14 and others added 15 commits March 6, 2025 12:57
# Proposed changes

- Change validation logic to follow Standard Schema consumption
- Remove individual adapters for validation libraries

## Related issue(s) or discussion(s)

re #321 

---------

Co-authored-by: Edoardo Ranghieri <[email protected]>
BREAKING CHANGE: Remove the deprecated execute on mount functionality, found in hooks.
… functions (#336)

This PR introduces a callback in both action and hook contexts, called
`onNavigation`, that is triggered when the user uses a function imported
from `next/navigation` inside the action body.

re #325
…on, throw them instead (#337)

This PR removes the shaper `handleBindArgsValidationErrorsShape` util
function, and also removes `bindArgsValidationErrors` from the result.
Instead, if bound args validation errors occur, throw them on the
server, using a new `ActionBindArgsValidationError` error class.
Code in this PR brings back the always defined safe action result, so
users can destructure the result object, and access its optional
properties directly. This is because `next/navigation` functions don't
trigger an `undefined` result anymore, so everything works as expected
now.
…339)

The code in this PR renames the `schema` instance method to
`inputSchema`.
Since introducing output validation with the `outputSchema` method, I
have considered renaming `schema` to `inputSchema` to make its purpose
clearer.

Note that the `schema` method will remain as an alias for `inputSchema`,
but will be removed in a future release.
Code in this PR simplifies internal library code by a lot.
If a metadata schema is provided via `defineMetadataSchema` init function, and the `metadata` method
is not used before `action`/`stateAction` method, now an error will inform the user that the type is
incomplete.
Copy link

vercel bot commented Mar 26, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-safe-action-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 28, 2025 11:38pm
next-safe-action-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 28, 2025 11:38pm

…wValidationErrors` (#346)

Code in this PR adds the ability to override the validation error
message, when the `throwValidationErrors` option is used at the action
level, using an optional async function called `overrideErrorMessage`,
that returns the overridden error message, instead of the default one.
Copy link

🎉 This PR is included in version 8.0.0-beta.12 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version 8.0.0-beta.13 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

github-actions bot commented Apr 4, 2025

🎉 This PR is included in version 8.0.0-beta.14 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version 8.0.0-beta.24 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version 8.0.0-beta.25 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chuckstock
Copy link

curious on eta of this version 8? about to migrate some code and wanted to use safe-action, buti think i want to wait for this update

Copy link

🎉 This PR is included in version 8.0.0-beta.26 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version 8.0.0-beta.27 🎉

The release is available on:

Your semantic-release bot 📦🚀

@TheEdoRan
Copy link
Owner Author

Hey @chuckstock, I'll probably release it later today. I just need to fix the HookForm/Resolvers compatibility issues in the React Hook Form adapter package, but the lib API is stable right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] next/navigation functions trigger success status and callbacks
3 participants