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

Compatibility with Next.js 15 and React 19 #778

Closed
catchergeese opened this issue Jun 27, 2024 · 4 comments · Fixed by #983
Closed

Compatibility with Next.js 15 and React 19 #778

catchergeese opened this issue Jun 27, 2024 · 4 comments · Fixed by #983
Assignees

Comments

@catchergeese
Copy link

catchergeese commented Jun 27, 2024

Describe the bug
@contentful/live-preview throws an error in Next.js 15 (RC) and React 19 (RC).

To Reproduce
Steps to reproduce the behavior:

  1. Setup project with Next.js version 15 with React 19
  2. Follow @contentful/live-preview docs for Next.js integration
  3. Run npm run dev to run dev server
  4. See error TypeError: Cannot read properties of undefined (reading 'ReactCurrentDispatcher')

Expected behavior
It works.

Context (please complete the following information):

  • Live preview SDK version number: 4.2.3

Additional context
@contentful/live-preview limits React's version to 18.
I built the package locally after removing this restriction and the error is gone (but I didn't test it in-and-out).

@KlotzJesse
Copy link

Can be fixed by correctly stop bundeling react into the packages, by changing the external option in vite.config to:
external: ["react", /^react\/.*/, "react-dom", /react-dom\/.*/],

@YvesRijckaert
Copy link
Contributor

Issue should be fixed with the newest version: 4.5.17

@YvesRijckaert
Copy link
Contributor

Reopening as there seemed to have been some issues with older versions of Next / React with this change 😓

@YvesRijckaert YvesRijckaert reopened this Dec 9, 2024
@YvesRijckaert YvesRijckaert self-assigned this Dec 10, 2024
@YvesRijckaert
Copy link
Contributor

Fixed with latest release 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants