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

Update README for using ably-js in Next.js 15 #1790

Open
VeskeR opened this issue Jun 13, 2024 · 0 comments
Open

Update README for using ably-js in Next.js 15 #1790

VeskeR opened this issue Jun 13, 2024 · 0 comments
Labels
documentation Improvements or additions to public interface documentation (API reference or readme). investigate

Comments

@VeskeR
Copy link
Contributor

VeskeR commented Jun 13, 2024

Something has changed in Next.js 15 so it's now necessary to load components using ably-js with next/dynamic and use 'use client'; directive for such components, otherwise we would get Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: errors and possible build issues like in #1788.

See working Next.js 15 (RC) example app: https://github.com/VeskeR/ably-js-nextjs-15-example (need to run npm install --legacy-peer-deps due to this npm issue and using prerelease version of next.js).
And see Next.js 14 app: https://github.com/ably-labs/ably-nextjs-fundamentals-kit. You can remove 'use client'; there and skip loading components using next/dynamic and it would still work.

Need to investigate what's changed and update README for using ably-js with Next.js 15.

┆Issue is synchronized with this Jira Task by Unito

@VeskeR VeskeR added investigate documentation Improvements or additions to public interface documentation (API reference or readme). labels Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to public interface documentation (API reference or readme). investigate
Development

No branches or pull requests

1 participant