Skip to content

Commit

Permalink
refactor(hooks): don't set empty result before throwing Next navigati…
Browse files Browse the repository at this point in the history
…on errors
  • Loading branch information
TheEdoRan committed Jun 12, 2024
1 parent ec95a10 commit c3a4b40
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions packages/next-safe-action/src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ export const useAction = <
.then((res) => setResult(res ?? EMPTY_HOOK_RESULT))
.catch((e) => {
if (isRedirectError(e) || isNotFoundError(e)) {
setResult(EMPTY_HOOK_RESULT);
throw e;
}

Expand All @@ -180,7 +179,6 @@ export const useAction = <
startTransition(() => {
safeActionFn(input as S extends Schema ? InferIn<S> : undefined)
.then((res) => {
setResult(res ?? EMPTY_HOOK_RESULT);
resolve(res);
})
.catch((e) => {
Expand Down Expand Up @@ -271,7 +269,6 @@ export const useOptimisticAction = <
.then((res) => setResult(res ?? EMPTY_HOOK_RESULT))
.catch((e) => {
if (isRedirectError(e) || isNotFoundError(e)) {
setResult(EMPTY_HOOK_RESULT);
throw e;
}

Expand All @@ -296,7 +293,6 @@ export const useOptimisticAction = <
setOptimisticValue(input as S extends Schema ? InferIn<S> : undefined);
safeActionFn(input as S extends Schema ? InferIn<S> : undefined)
.then((res) => {
setResult(res ?? EMPTY_HOOK_RESULT);
resolve(res);
})
.catch((e) => {
Expand Down

0 comments on commit c3a4b40

Please sign in to comment.