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

Regression in canary / 15.2 breaks libraries pre-compiled with React Compiler, it works fine in 15.1 #74826

Closed
stipsan opened this issue Jan 13, 2025 · 0 comments · Fixed by #74890
Labels
bug Issue was opened via the bug report template. Module Resolution Module resolution (CJS / ESM, module resolving).

Comments

@stipsan
Copy link
Contributor

stipsan commented Jan 13, 2025

Link to the code that reproduces this issue

https://github.com/sanity-io/use-memo-cache-repro

To Reproduce

  1. pnpm install
  2. pnpm build

Fails with an error:

Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: w.H.useMemoCache is not a function
    at c (/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:68:4306)
    at /.next/server/app/page.js:1:25800
    at eC (/.next/server/app/page.js:1:27452)
    at nO (/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:20:45681)
    at nj (/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:20:47456)
    at nN (/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:20:65255)
    at nI (/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:20:62886)
    at nA (/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:20:46033)
    at nj (/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:20:47502)
    at nj (/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:20:62237)

pnpm dev logs a similar error:

 TypeError: resolveDispatcher(...).useMemoCache is not a function
    at App (app/page.tsx:9:32)
   7 |
   8 | export default function App() {
>  9 |   const seconds = useObservable(observable, 0)
     |                                ^
  10 |   return <>Seconds: {seconds}</>
  11 | }
  12 | {
  digest: '41685224'
}
 GET / 500 in 124ms

But is able to recover and client render. It seems to skip hydration when this happens.

Current vs. Expected behavior

The issue only happens if using canary of next. Downgrading to 15.1 works, but is a deal breaker for customers at Sanity that want to use PPR as it requires canary.

Here's 15.1 deployed to vercel working just fine: https://use-memo-cache-repro-git-downgrade.sanity.dev/

Provide environment information

Node.js v20.18.1

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.2.0: Fri Dec  6 19:03:40 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6041
  Available memory (MB): 131072
  Available CPU cores: 16
Binaries:
  Node: 20.18.1
  npm: 10.8.2
  Yarn: N/A
  pnpm: 9.15.3
Relevant Packages:
  next: 15.2.0-canary.6 // Latest available version is detected (15.2.0-canary.6).
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.3
Next.js Config:
  output: N/A

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

Module Resolution

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

next dev (local), next build (local), next start (local), Vercel (Deployed)

Additional context

The repro uses react-rx to demonstrate the problem.
The impact atm is all of Sanity's packages that uses React Compiler:

  • sanity
  • @sanity/visual-editing
  • react-rx
  • @sanity/ui
  • @portabletext/editor
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. Module Resolution Module resolution (CJS / ESM, module resolving).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant