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 globalThis (global) singleton problem #69042

Open
devweissmikhail opened this issue Aug 19, 2024 · 0 comments
Open

generateStaticParams globalThis (global) singleton problem #69042

devweissmikhail opened this issue Aug 19, 2024 · 0 comments
Labels
bug Issue was opened via the bug report template. Performance Anything with regards to Next.js performance. Runtime Related to Node.js or Edge Runtime with Next.js.

Comments

@devweissmikhail
Copy link

Link to the code that reproduces this issue

https://github.com/vaneenige/next-app-router-singleton

To Reproduce

  1. Set a new key in the global object
  2. Try to get this key from the global object inside generateStaticParams

Current vs. Expected behavior

I expected the global object to be the same in this environment

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6030
  Available memory (MB): 18432
  Available CPU cores: 12
Binaries:
  Node: 20.11.1
  npm: 10.2.4
  Yarn: N/A
  pnpm: 9.5.0
Relevant Packages:
  next: 14.2.5 // Latest available version is detected (14.2.5).
  eslint-config-next: N/A
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.5.4
Next.js Config:
  output: export

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

Performance, Runtime

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

next dev (local), next build (local)

Additional context

For example, I declare a new key in the global object using instrumentation.ts (it doesn't really matter where you do it)

1

When I try to get it inside the generateStaticParams function, I get undefined

2

But after trying the same thing in the component, I got the expected result:

3

I found similar issues and they seem to be related:
#65350
#52165

It seems to be running in a separate environment. But how can I solve this problem?

@devweissmikhail devweissmikhail added the bug Issue was opened via the bug report template. label Aug 19, 2024
@github-actions github-actions bot added Performance Anything with regards to Next.js performance. Runtime Related to Node.js or Edge Runtime with Next.js. labels Aug 19, 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. Performance Anything with regards to Next.js performance. Runtime Related to Node.js or Edge Runtime with Next.js.
Projects
None yet
Development

No branches or pull requests

2 participants
@devweissmikhail and others