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

generateStaticParams slows down dev #44646

Closed
1 task done
rijk opened this issue Jan 6, 2023 · 1 comment · Fixed by #46940
Closed
1 task done

generateStaticParams slows down dev #44646

rijk opened this issue Jan 6, 2023 · 1 comment · Fixed by #46940
Labels
bug Issue was opened via the bug report template.

Comments

@rijk
Copy link

rijk commented Jan 6, 2023

Verify canary release

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

Provide environment information

npx next info

    Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.2.0: Fri Nov 11 02:06:26 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T8112
    Binaries:
      Node: 16.18.1
      npm: 8.19.2
      Yarn: N/A
      pnpm: 7.22.0
    Relevant packages:
      next: 13.1.2-canary.1
      eslint-config-next: 13.1.1
      react: 18.2.0
      react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true), Data fetching (gS(S)P, getInitialProps)

Link to the code that reproduces this issue

  • (can provide if necessary)

To Reproduce

Have a tree with quite some static paths. For me it is:

  • Level 1: 8
    • Level 2: 160

So in total 1280 paths.

Describe the Bug

Loading pages (especially from level 2) is excruciatingly slow in development:

image

I had to work around it by doing:

export async function generateStaticParams() {
  if (process.env.NODE_ENV !== 'production') return []

  // ...
}

Then it's:

image

Expected Behavior

I don't see the need to block rendering in development, as these paths are not statically generated anyway. So it would be nice if Next did this if (process.env.NODE_ENV !== 'production') skip automatically.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@rijk rijk added the bug Issue was opened via the bug report template. label Jan 6, 2023
ijjk added a commit that referenced this issue Mar 8, 2023
Follow-up to #46906 this ensures
we revalidate `generateStaticParams`/`getStaticPaths` in the background
in development so that we aren't blocking refreshes an much
un-necessarily if the paths cache is already populated.

Fixes: #44646
Fixes: #38757
x-ref:
#17977 (comment)
x-ref: #20076
x-ref: #14378
@github-actions
Copy link
Contributor

github-actions bot commented Apr 8, 2023

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant