redirect with type push is not adding history in browser stack.
Answered
SID posted this in #help-forum
SIDOP
Redirect with type push is not adding history in browser stack when using redirect form a server action.
tried using Link and with Link it is working.
this is sample of how I am using it.
tried using Link and with Link it is working.
this is sample of how I am using it.
import Image from "next/image";
import styles from "./page.module.css";
import { redirect } from "next/navigation";
import { RedirectType } from "next/dist/client/components/redirect";
import Link from "next/link";
const processAmount = async (formData: FormData) => {
"use server";
redirect(`/test1`, RedirectType.push);
};
export default function Home() {
return (
<main>
<form action={processAmount} className={styles.form}>
<button type="submit">server action</button>
</form>
<Link href={"test1"}>
<button>link</button>
</Link>
</main>
);
}Answered by fuma
This is a bug which is fixed in 13.4.20, see https://github.com/vercel/next.js/issues/53911
Try updating to the latest canary version of Next.
Try updating to the latest canary version of Next.
1 Reply
This is a bug which is fixed in 13.4.20, see https://github.com/vercel/next.js/issues/53911
Try updating to the latest canary version of Next.
Try updating to the latest canary version of Next.
Answer