devrnt / react-use-intercom

☎️ React Intercom integration without the hassle, powered by hooks.
https://devrnt.github.io/react-use-intercom/#/useIntercom
MIT License
333 stars 43 forks source link

Apply `use client` directive to `IntercomProvider` #650

Closed rubendinho closed 1 year ago

rubendinho commented 1 year ago

The App Router in NextJS 13 requires Providers used in server components to have the use client directive.

This means that using IntercomProvider in a Root Layout (which must be an SRC) requires wrapping it in a client-side component.

This PR declares the provider as a client component.

See: https://nextjs.org/docs/getting-started/react-essentials#rendering-third-party-context-providers-in-server-components

changeset-bot[bot] commented 1 year ago

⚠️ No Changeset found

Latest commit: 79af64d4d4be0fe89bebb778aaf624e33f53c08d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

devrnt commented 1 year ago

Big thanks for this PR. However, I'm not planning to introduce any platform/framework specifics in this library

rubendinho commented 1 year ago

Big thanks for this PR. However, I'm not planning to introduce any platform/framework specifics in this library

@devrnt I don't believe the "use client" is framework-specific. It's part of React's server component realm. See https://github.com/reactjs/rfcs/blob/main/text/0227-server-module-conventions.md

NextJS happens to be the first major framework adopting RSCs.

devrnt commented 1 year ago

Big thanks for this PR. However, I'm not planning to introduce any platform/framework specifics in this library

@devrnt I don't believe the "use client" is framework-specific. It's part of React's server component realm. See https://github.com/reactjs/rfcs/blob/main/text/0227-server-module-conventions.md

NextJS happens to be the first major framework adopting RSCs.

Fair enough, but I stand by my position. This could be reconsidered in the future when the adoption rate is higher and/or this feature is more requested