Replies: 5 comments 6 replies
-
Can you share an example? |
Beta Was this translation helpful? Give feedback.
-
I am also very confused on the second parameter in server action. Although I passed second parameter with 'RedirectType.replace', server action always ignore the second parameter and it pushes so that I can go back to previous page. As @ezeparziale mentioned, I can just use 'useRouter' and replace it in the client component, but it keeps bothering me that the usage of redirect optional parameter in server action.... |
Beta Was this translation helpful? Give feedback.
-
I believe this issue should be classified as a "Bug" rather than an "Idea" because it describes a malfunction in the existing functionality. Could we please update the issue type accordingly? |
Beta Was this translation helpful? Give feedback.
-
Any updates on this ? |
Beta Was this translation helpful? Give feedback.
-
Can confirm, |
Beta Was this translation helpful? Give feedback.
-
Goals
Background
I've been wondering how can I fully utilize server actions for mutations. I encountered a problem which I do a DELETE on a data detail page (ex:
blog/will_deleted_id
), after that I want to either replace my browser history into another page or navigate back to previous page (ex:blog
). With currentredirect
function on server action, the only opt is to push a page which results a navigate back into a 404 (blog/wil_deleted_id
page already deleted).The workaround I used for this is to use navigation on client side which not as convenience as doing post mutation functions on server
Proposal
Enable second argument of redirect function that works on server action, or a function to navigate back on server actions
Example
while The type parameter has no effect when used in Server Components this example will push the browser history regardless the second param given
Beta Was this translation helpful? Give feedback.
All reactions