Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server action never resolves if router.push in the meantime #74246

Open
lcswillems opened this issue Dec 23, 2024 · 0 comments
Open

Server action never resolves if router.push in the meantime #74246

lcswillems opened this issue Dec 23, 2024 · 0 comments
Labels
bug Issue was opened via the bug report template.

Comments

@lcswillems
Copy link

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/muddy-morning-78ym53?file=%2Fapp%2Fpage.tsx%3A10%2C1

To Reproduce

  1. Open the Codesandbox

Current vs. Expected behavior

In app/page.tsx:

"use client";

import { useRouter } from "next/navigation";
import { useEffect, useState } from "react";
import { f } from "./server";

export default function Page() {
  const router = useRouter();
  const [text, setText] = useState("");

  useEffect(() => {
    Promise.all([f(), f()]).then(() => setText("finished"));
    router.replace("?");
  }, []);

  return <>{text}</>;
}

In app/server.ts:

"use server";

export const f = async () => {};

Promise.all([f(), f()]) will never resolve. It seems that in particular the 2nd f() doesn't resolve.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec  5 13:09:44 UTC 2024
  Available memory (MB): 13684
  Available CPU cores: 16
Binaries:
  Node: 20.11.1
  npm: 10.2.4
  Yarn: 1.22.22
  pnpm: 9.9.0
Relevant Packages:
  next: 15.1.2 // Latest available version is detected (15.1.2).
  eslint-config-next: 15.0.4
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.6.2
Next.js Config:
  output: standalone

Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

next dev (local), next start (local)

Additional context

No response

@lcswillems lcswillems added the bug Issue was opened via the bug report template. label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

1 participant