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

[BUG] React suspense not working #336

Open
spiros132 opened this issue Feb 4, 2025 · 0 comments
Open

[BUG] React suspense not working #336

spiros132 opened this issue Feb 4, 2025 · 0 comments
Labels
bug Something isn't working triage

Comments

@spiros132
Copy link

Describe the bug

When I add a suspense to a component it doesn't work as intended and loads the "main" component.

Steps to reproduce

  1. Run the npm create cloudflare@latest my-next-app -- --framework=next --experimental command to create a new app
  2. Inside of the src/app/page.tsx replace the code to the following instead:
import { Suspense } from "react";

function Loading() {
  return <p>Loading...</p>;
}

async function Component() {
  const delay = new Promise(resolve => {
    setTimeout(resolve, 5000);
  });

  await delay;

  return <p>Component!</p>;
}

export default function Home() {
  return (
    <Suspense fallback={<Loading/>}>
      <Component/>
    </Suspense>
  );
}
  1. Run npm run build and then after npm run start
  2. The "Component" renders immediately without a delay of 5 seconds

Expected behavior

The expected behaviour works if you instead run npm run dev, where the Loading component is rendered for 5 seconds, and then the other component is rendered.

@opennextjs/cloudflare version

0.4.4

Wrangler version

3.107.3

next info output

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Tue Nov 5 00:21:55 UTC 2024
  Available memory (MB): 31642
  Available CPU cores: 32
Binaries:
  Node: 22.13.1
  npm: 11.1.0
  Yarn: N/A
  pnpm: 9.15.4
Relevant Packages:
  next: 14.2.23 // An outdated version detected (latest is 15.1.6), upgrade is highly recommended!
  eslint-config-next: 14.2.23
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.7.3
Next.js Config:
  output: N/A
 ⚠ An outdated version detected (latest is 15.1.6), upgrade is highly recommended!
   Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
   Read more - https://nextjs.org/docs/messages/opening-an-issue

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Development

No branches or pull requests

1 participant