Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

[BUG] Server action redirects fail when Next.js 16 cacheComponents is enabled #15

Description

@ramonmalcolm10

When using Next.js 16 with cacheComponents: true enabled in next.config, server action redirects using redirect() from next/navigation do not work. The redirect is not executed and the user remains on the current page.

Steps to Reproduce

  1. Create a Next.js 16 project with this adapter
  2. Enable cacheComponents in next.config:
    const nextConfig: NextConfig = {
      cacheComponents: true,
    };
    export default nextConfig;
  3. Create a server action with a redirect:
'use server'

import { actionClient } from "@/lib/safe-action";
import { redirect } from "next/navigation";

export const create = actionClient
    .action(async () => {
    // Perform some action
    redirect('/');
});
  1. Use the action with useHookFormAction:
'use client'

import { useHookFormAction } from "@next-safe-action/adapter-react-hook-form/hooks";
import { create } from "./action";

export function MyForm() {
   const { handleSubmitWithAction } = useHookFormAction(create, resolver);
   return <form onSubmit={handleSubmitWithAction}>...</form>;
}
  1. Submit the form

Expected Behavior

The redirect('/') call should navigate the user to the homepage after the server action completes.

Actual Behavior

The redirect does not occur. The user remains on the current page. The server action executes successfully, but the redirect is not triggered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions