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

[15.0.0-canary.111+] Infinite loading page when fetch has "force-cache" in generateMetadata layout.tsx #69309

Open
aXenDeveloper opened this issue Aug 26, 2024 · 2 comments
Labels
bug Issue was opened via the bug report template. Metadata Related to Next.js' Metadata API.

Comments

@aXenDeveloper
Copy link

Link to the code that reproduces this issue

https://github.com/aXenDeveloper/next-app-canary

To Reproduce

  1. Clone repo,
  2. pnpm i,
  3. Start app with pnpm dev

or

  1. pnpm create next-app@canary
  2. In src/app/layout.tsx replace metadata to:
    export const generateMetadata = async (): Promise<Metadata> => {
      await fetch("http://localhost:8080/graphql", {
        cache: "force-cache"
      });
    
      return {
        title: "Create Next App",
        description: "Generated by create next app"
      };
    };

Current vs. Expected behavior

Loaded home page.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.0.0: Mon Aug 12 21:27:51 PDT 2024; root:xnu-11215.1.10~5/RELEASE_ARM64_T6020
  Available memory (MB): 16384
  Available CPU cores: 12
Binaries:
  Node: 20.11.0
  npm: 10.2.4
  Yarn: N/A
  pnpm: 9.5.0
Relevant Packages:
  next: 15.0.0-canary.130 // Latest available version is detected (15.0.0-canary.130).
  eslint-config-next: 15.0.0-canary.130
  react: 19.0.0-rc-eb3ad065-20240822
  react-dom: 19.0.0-rc-eb3ad065-20240822
  typescript: 5.5.4
Next.js Config:
  output: N/A

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

Metadata

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

next dev (local), next start (local)

Additional context

When fetch has "force-cache" inside generateMetadata() and API has fetch error then page will have infinite loading.

export const generateMetadata = async (): Promise<Metadata> => {
  await fetch("http://localhost:8080/graphql", {
    cache: "force-cache"
  });

  return {
    title: "Create Next App",
    description: "Generated by create next app"
  };
};

It happens from 15.0.0-canary.111+.
15.0.0-canary.110 works fine.

@aXenDeveloper aXenDeveloper added the bug Issue was opened via the bug report template. label Aug 26, 2024
@github-actions github-actions bot added the Metadata Related to Next.js' Metadata API. label Aug 26, 2024
@vercel vercel deleted a comment Aug 26, 2024
@aXenDeveloper aXenDeveloper changed the title Infinite loading page when fetch has "force-cache" in generateMetadata layout.tsx [15.0.0-canary.111+] Infinite loading page when fetch has "force-cache" in generateMetadata layout.tsx Aug 26, 2024
@AbhiShake1
Copy link
Contributor

hello, are you still able to reproduce this in v15.0.0-canary.132?

@aXenDeveloper
Copy link
Author

@AbhiShake1 Yes, also happen on canary.132.

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. Metadata Related to Next.js' Metadata API.
Projects
None yet
Development

No branches or pull requests

3 participants
@AbhiShake1 @aXenDeveloper and others