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

[BUG] using notFound() in server action is handled as successful action #325

Open
2 tasks done
maltesa opened this issue Feb 19, 2025 · 1 comment
Open
2 tasks done
Labels
bug Something isn't working

Comments

@maltesa
Copy link

maltesa commented Feb 19, 2025

Are you using the latest version of this library?

  • I verified that the issue exists in the latest next-safe-action release

Is there an existing issue for this?

  • I have searched the existing issues and found nothing that matches

Describe the bug

The following code logs Success. to the browsers console.

// action.ts
export const userAction  = userActionClient.action(async () => {
  notFound()
})

// Component.tsx
// ...
  const { execute } = useAction(updateAssignmentSettingsAction, {
    onSuccess: () => console.log('Success.'),
    onError: () => console.log('Error'),
  })

Reproduction steps

Call notFound() in a server action.

Expected behavior

I expected the onError callback to fire.

Link to a minimal reproduction of the issue

none

Operating System

macOs

Library version

7.10.4

Next.js version

15.1.5

Node.js version

22

Additional context

No response

@maltesa maltesa added the bug Something isn't working label Feb 19, 2025
@IPJT
Copy link

IPJT commented Feb 20, 2025

Same thing if the device looses network connection. Seems very weird

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants