vercel / next.js

The React Framework
https://nextjs.org
MIT License
124.76k stars 26.63k forks source link

Next.js 14.2.0 changed facebook/lexical behavior in dev mode #64486

Open petyosi opened 4 months ago

petyosi commented 4 months ago

Link to the code that reproduces this issue

https://github.com/mdx-editor/lexical-issue

To Reproduce

To reproduce, run the project and open the console. You will see:

binding counter 0
binding counter 1
Update listener from instance 0

Typing in the editor triggers updates from instance 0.

If you run

npm i next@14.1.1

And run the project again, you will see:

binding counter 0
binding counter 1
Update listener from instance 1

Typing in the editor triggers updates from instance 1.

Current vs. Expected behavior

The behavior of Next 14.1.1. The latest instance should be the one triggering changes.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:41 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T8103
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 20.11.1
  npm: 10.2.4
  Yarn: 1.22.19
  pnpm: 8.15.5
Relevant Packages:
  next: 14.2.1-canary.5 // Latest available version is detected (14.2.1-canary.5).
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.1.3
Next.js Config:
  output: N/A

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

Not sure

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

next dev (local)

Additional context

No response

meronogbai commented 2 months ago

I encountered a very similar issue and posted a PR in https://github.com/facebook/lexical/pull/6271. Maybe you can try patching @liveblocks/react with similar changes?