Should redirect
send an error?
#66800
hiroki0525
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Developer Experiences: When using
redirect
, it must be determined whether anError
or a nonError
object is thrown.Background
First, Suppose that such a function has been defined.
Next, suppose the following Server Action is defined using
generateFormAction
.Finally, if
submitAction
is used as Server Action in aform
tag withuseActionState
, the user will not be redirected to the specified path because of thrown byredirect
and .next.js/packages/next/src/client/components/redirect.ts
Line 49 in 8bac76a
This is what it looks like on screen because the
e.message
which isNEXT_REDIRECT
is displayed.Proposal
JavaScript is a flexible language. One option is to throw objects other than
Error
.Beta Was this translation helpful? Give feedback.
All reactions