next.js icon indicating copy to clipboard operation
next.js copied to clipboard

[v13] Appdir generateStaticParams makes ErrorBoundary not working

Open FourwingsY opened this issue 2 years ago • 0 comments

Verify canary release

  • [X] I verified that the issue exists in the latest Next.js canary release

Provide environment information

    Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.2.0: Sun Oct 16 18:09:52 PDT 2022; root:xnu-8792.60.32.0.1~11/RELEASE_ARM64_T6000
    Binaries:
      Node: 16.13.0
      npm: 8.15.0
      Yarn: 1.22.17
      pnpm: N/A
    Relevant packages:
      next: 13.0.4
      eslint-config-next: 13.0.4
      react: 18.2.0
      react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

in local yarn dev

ErrorBoundary catch static page errors. ErrorBoundary cannot catch page errors when generateStaticParams are exported in dynamic routes.

Expected Behavior

Catch errors on page with generateStaticParams are given.

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

https://stackblitz.com/edit/vercel-next-js-1xml9c?file=app/with-static-params/[key]/page.tsx

To Reproduce

make a page with dynamic routes, and export generateStaticParams

/test/[key]/page.tsx

export function generateStaticParams() {
  return [{ key: 'error' }];
}

export default function PageWithError() {
  throw new Error('throw');
  return <h1>Page</h1>;
}

/test/[key]/error.tsx

'use client';

export default function Error() {
  return <button>Caught!</button>;
}

and go /test/error

FourwingsY avatar Nov 18 '22 16:11 FourwingsY