-
Hi, I was wondering why useServerAction(createInstituteAction, {
onSuccess: ({ data }) => {
// Expecting data to have the type of `createInstituteAction`s return value
// but value is: <createInstituteAction return value> | undefined
}
}) Since the actions succeed, the value must be set, right? |
Beta Was this translation helpful? Give feedback.
Answered by
TheEdoRan
Jul 24, 2024
Replies: 1 comment 1 reply
-
See: The reason is that the action runs |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
maltesa
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See:
The reason is that the action runs
onSuccess
callback even when you useredirect
, which internally throws an error caught by Next.js to perform the redirect. In this case,data
is undefined.