Skip to content
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

Update dependency next-safe-action to v7 #109

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Oct 14, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
next-safe-action ^6.2.0 -> ^7.0.0 age adoption passing confidence

Release Notes

TheEdoRan/next-safe-action (next-safe-action)

v7.9.9

Compare Source

Refactors

v7.9.8

Compare Source

Documentation
  • readme: add Arcjet sponsorship (09d6af1)

v7.9.7

Compare Source

Refactors
  • validation-errors: allow async shaper functions (8c86c1f)

v7.9.6

Compare Source

Bug Fixes
  • validation-errors: type inference for branded, nullable, optional and array types (#​284) (2e1fe62)

v7.9.5

Compare Source

Refactors

v7.9.4

Compare Source

Refactors
  • hooks: deprecate executeOnMount (45e0f96)

v7.9.3

Compare Source

Bug Fixes

v7.9.2

Compare Source

Refactors

v7.9.1

Compare Source

Refactors
  • remove additional fetchError prop from hook return object (#​262) (3d32f9d)

v7.9.0

Compare Source

Features
  • merge server error handling functions into handleServerError (#​257) (c900720)
Description

v7.9.0 merges the functionality of handleServerErrorLog and handleReturnedServerError functions into a single optional initialization function called handleServerError. This change has been made because having two functions for server error handling is unnecessary, you can easily manage both logging and returned error within a single function.

Upgrade guide

Suppose you have this code using next-safe-action < 7.9.0:

import { createSafeActionClient } from "next-safe-action";

const actionClient = createSafeActionClient({
  // handles logging
  handleServerErrorLog(error) {
    console.error("my custom error log:", error.message);
  },
  // handles returned shape
  handleReturnedServerError(error) {
    return {
      message: error.message,
    };
  },
});

With next-safe-action >= 7.9.0 it becomes:

import { createSafeActionClient } from "next-safe-action";

const ac = createSafeActionClient({
  // handles both logging and returned shape
  handleServerError(error) {
    console.error("my custom error log:", error.message);
    return {
      message: error.message,
    };
  },
});

So, minimal refactoring is required, and the action client creation is cleaner this way.


[!NOTE]
Even if you want to change just the logging mechanism, you still have to return an error shape from handleServerError, otherwise the resulting type would be void.

So, if you want for instance keep the default error message as the returned server error and just update the console logging, you can do it like this:

import { createSafeActionClient, DEFAULT_SERVER_ERROR_MESSAGE } from "next-safe-action";

const ac = createSafeActionClient({
  handleServerError(error) {
    console.error("my custom error log:", error.message);
    return DEFAULT_SERVER_ERROR_MESSAGE;
  },
});

v7.8.2

Compare Source

Documentation
  • update library description (8e654bc)

v7.8.1

Compare Source

Documentation
  • update documentation links (7f9888a)

v7.8.0

Compare Source

Features

v7.7.1

Compare Source

Bug Fixes
  • types: infer MetadataSchema in SafeActionClient (2bf7fa1)

v7.7.0

Compare Source

Features
  • middleware: make createMiddleware function stable (d9d326e)

v7.6.4

Compare Source

Refactors

v7.6.3

Compare Source

Bug Fixes
  • parallelize action callbacks execution (53ddab6)

v7.6.2

Compare Source

Bug Fixes
  • types: allow omitting input in executeOnMount when it's undefined (b2c02f0), closes #​217

v7.6.1

Compare Source

Bug Fixes
  • hooks: add isTransitioning and isPending shorthand statuses to return object (#​231) (6e23887), closes #​227

v7.6.0

Compare Source

Features

v7.5.0

Compare Source

Features

v7.4.3

Compare Source

Bug Fixes
  • hooks: pass onExecute callback to handler in useAction (0ced081)

v7.4.2

Compare Source

Performance improvements
  • hooks: use setTimeout instead of flushSync to update state (8207452)

v7.4.1

Compare Source

Build System
  • make Yup an optional peer dependency (a71e64b)

v7.4.0

Compare Source

Features
  • add action throwValidationErrors and throwServerError util props (#​208) (c9d02e0)

v7.3.0

Compare Source

Features

v7.2.2

Compare Source

Build System

v7.2.1

Compare Source

Bug Fixes
  • hooks: don't export useStateAction from /hooks path (079324d)

v7.2.0

Compare Source

Features
  • built-in support for multiple validation libraries (#​202) (baff76b)

v7.1.3

Compare Source

Refactors
  • pass util props to handleReturnedServerError and handleServerErrorLog (#​184) (f8fe120), closes #​177

v7.1.2

Compare Source

Bug Fixes
  • hooks: pass reset function to useCallback (b3e78bb)

v7.1.1

Compare Source

Build System
  • bump TypeSchema version (80ec82a)

v7.1.0

Compare Source

Features
  • support extending previous schemas inside schema method (dfd8ad3)
  • validation-errors: support throwing validation errors via init option (769a372)

v7.0.2

Compare Source

Refactors

v7.0.1

Compare Source

Bug Fixes
  • hooks: export useStateAction hook from /stateful-hooks path (#​166) (7389fb9)

v7.0.0

Compare Source

Features
  • action-client: export a copy of safe action client from /zod path (#​115) (20a2ef5)
  • add action execution callbacks (#​161) (804a1cf)
  • add Next navigation props to onSuccess and onSettled action callbacks (9b37224)
  • allow direct use of action method, without schema call (3935e9f)
  • allow omitting schema argument in schema method (#​102) (aa11577)
  • example: add nested schema example (e4a0346)
  • hooks: return executeAsync from useAction and useOptimisticAction hooks (#​147) (e0f5c20), closes #​137 #​72 #​94
  • hooks: return input from hooks (#​118) (17935ad), closes #​116
  • support binding additional arguments (#​97) (f628dc7)
  • support generic metadata type (1e55068)
  • support generic server error (#​93) (3d677bd)
  • support middleware chaining (#​89) (714554d), closes #​88
  • support nested validation errors (e6e4e44), closes #​51
  • support passing schema via async function (#​154) (4dcf742), closes #​111
  • support setting default validation errors shape per instance (#​152) (0565085)
  • support stateful actions via stateAction method and useStateAction hook (#​110) (d060132)
  • validation-errors: support customization of validation errors format (#​101) (66d4ea3), closes #​98
  • validation-errors: support flattening via flattenValidationErrors function (#​100) (9ae6764)
  • validation-errors: support setting validation errors in action's server code function (#​52) (64fb643)
Bug Fixes
  • correctly handle internal framework errors (8596aab)
  • don't push middleware functions in safe client array in use method (054487c)
  • exported class expression ts error 4094 (#​96) (f36392a)
  • hooks: useStateAction execution flow (16e5693)
  • hooks: form actions support (79e48b0)
  • make result optional to handle Next navigation events (68d8ed2)
  • prevent sharing metadata between actions (e8932bb)
  • remove unwanted exported private properties from action client (1fbe49c)
  • return proper results when handling framework navigation functions (c8496f7)
  • types: don't allow undefined results for stateful actions (ec95a10)
  • types: handle result undefined value at the action level (a9a2c8c)
  • validation errors type for optional nested schema objects (94843fd), closes #​51
  • validation-errors: server validation errors were incorrectly processed by typeschema clients (cd567a2)
Refactors
  • action-builder: simplify try/catch block for middleware stack execution (f356709)
  • example: directly import homepage Server Action in Client Component (b1a0077)
  • example: reorganize examples, use Tailwind (#​77) (6e73cae)
  • hooks: better useOptimisticAction variable names (131f8bf)
  • hooks: don't set empty result before throwing Next navigation errors (c3a4b40)
  • hooks: export EMPTY_HOOK_RESULT just from /hooks path (74c0dc8)
  • hooks: pass callbacks data in single object instead of multiple function args (14b1fbf)
  • hooks: return shorthand statuses from hooks (#​131) (6319f07), closes #​129
  • hooks: use separate type for server state in useOptimisticAction (#​134) (c38dbe1), closes #​127
  • improve internal code (#​150) (8e19d94)
  • remove clone method (8dc2138)
  • rename define method to action (1617d22)
  • rename ServerValidationError class to ActionServerValidationError (54b0b52)
  • restructure monorepo (#​104) (58373ab)
  • simpler buildValidationErrors implementation, move ValidationErrors type to index (5d3f258)
  • switch to MIT License (#​157) (775c2e7)
  • types: move PrettyMerge type in utils file (f7eb50c)
  • types: rename HookStateSafeActionFn to HookSafeStateActionFn (87b13b4)
  • upgrade TypeSchema to v0.13 (#​81) (9238190)
  • use Zod as the default validation library (#​144) (38003a5), closes #​105 #​140
  • validation-errors: rename rootErrors to formErrors for flattened errors (218176d)
Build System
  • lib: update dependencies and required React version to 18.3.1 (135821d)
  • update required Next.js version to >= 14 (5a05a40)
Documentation
  • add Form Actions support in features (a7cb006)
  • example: add React Hook Form example (23e05aa)
  • example: fix optimistic hook example (da5284e)
  • readme: fix broken logo src (493a7df)
  • readme: remove additional "contributing" title (51d4f33)
  • readme: remove old migration guides (fd64e29)
  • release: bump library version (e768ace)
  • release: update migration links (f24fdcd)
  • rename leftover validationError refs to validationErrors (2e687cb)
  • update contributing section (64a77bd)
  • update demo video (615cdfb)
  • update library description (dbd9639)
  • update links in JSDocs (0bdc31b)
  • update requirements and references to stable version (c52ba36)
  • update website links in JSDocs (4ea8559)
  • website: add bindArgsParsedInputs in "middlewareFn return value" section (e4aacbc)
  • website: add content to custom validation errors section (c9ae089)
  • website: add React Hook Form integration guide (ba9fd4c)
  • website: add WIP React Hook Form integration section (1623823)
  • website: fix broken getting started link (85d2689)
  • website: fix migration guide link (0dadf3e)
  • website: fix React Hook Form example (04c080d)
  • website: fix typo in getting started page (#​92) (5c7a45c)
  • website: format stars count (d53227e)
  • website: improve metadata documentation (fccd480)
  • website: move migrations to submenu (6f7c637)
  • website: reorganize documentation, add v7 sections (f70a0d7)
  • website: update colors and layout (f918f77)

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot force-pushed the renovate/next-safe-action-7.x branch from a822668 to f2d1dde Compare October 19, 2024 08:04
@renovate renovate bot force-pushed the renovate/next-safe-action-7.x branch from f2d1dde to 51a3201 Compare October 23, 2024 19:40
@renovate renovate bot force-pushed the renovate/next-safe-action-7.x branch from 51a3201 to 20a02c4 Compare October 25, 2024 09:18
@renovate renovate bot force-pushed the renovate/next-safe-action-7.x branch from 20a02c4 to b848804 Compare October 26, 2024 06:31
@renovate renovate bot force-pushed the renovate/next-safe-action-7.x branch from b848804 to beed000 Compare October 29, 2024 21:09
@renovate renovate bot force-pushed the renovate/next-safe-action-7.x branch from beed000 to 8bf8d09 Compare November 5, 2024 02:10
@renovate renovate bot force-pushed the renovate/next-safe-action-7.x branch from 8bf8d09 to 67820f8 Compare November 8, 2024 03:09
@renovate renovate bot force-pushed the renovate/next-safe-action-7.x branch from 67820f8 to b7ab946 Compare November 11, 2024 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants