Skip to content

Conversation

MikeCarbone
Copy link
Contributor

@MikeCarbone MikeCarbone commented Feb 20, 2025

[JS] Support React 19 in React SDKs

Breaking changes:

  • By upgrading Zustand to v4, feed.store now uses the UseBoundStore<StoreApi<FeedStoreState>> type (previously StoreApi<FeedStoreState>), meaning users no longer need their own implementation of zustand to use the store directly.

Users who relied only on useNotificationStore to access the store will not be affected, only users who use feedClient.store directly.


General Changes:

Enables support for React 19

This PR adds support for React 19 by including it within the peerDependencies of the various packages.

Removes react-popper dependency

This dependency was deprecated. I opted to use our existing dependency @popperjs/core for popup elements

Upgrades zustand to v4

Introduces a breaking change when users use the feedClient.store directly.

We decided not to upgrade to v5 because that would drop support for React 16, which we should support.

Upgrades internal Telegraph components for React 19 support

In order for these packages to support React 19, we had to first enable our Telegraph components to support React 19. After that was done, I bumped all of the Telegraph dependencies in this PR.

Next.js Example Now Uses Telegraph Components

Now that we have the @telegraph design system supporting React 19, we were able to use it in the next-js-example app.

Before After
Screenshot 2025-02-21 at 2 15 58 PM Screenshot 2025-02-21 at 2 16 34 PM

A note on react-native package:

As of 2 days ago, React 19 is now available on React Native, however, dependent packages like react-shallow-renderer need time to catch up and support this. So for now, we will leave the react-native package as is. This causes a dependency warning when running yarn install at the root of this repository, but that won't affect individual builds.


Linear issue

Addresses issue "Support React 19 #317"

Copy link

vercel bot commented Feb 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
javascript-ms-teams-connect-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 26, 2025 4:20pm
javascript-nextjs-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 26, 2025 4:20pm
javascript-slack-connect-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 26, 2025 4:20pm
javascript-slack-kit-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 26, 2025 4:20pm

Copy link

linear bot commented Feb 20, 2025

Copy link

changeset-bot bot commented Feb 20, 2025

🦋 Changeset detected

Latest commit: e2563d9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
client-example Minor
nextjs-example Minor
slack-kit-example Minor
@knocklabs/client Minor
@knocklabs/expo Minor
@knocklabs/react-core Minor
@knocklabs/react-native Minor
@knocklabs/react Minor
@knocklabs/expo-example Patch
@knocklabs/react-native-example Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link
Contributor Author

MikeCarbone commented Feb 20, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@MikeCarbone MikeCarbone changed the title removes react-popper dependency [JS] Support React 19 in React SDKs Feb 20, 2025
@MikeCarbone MikeCarbone marked this pull request as ready for review February 20, 2025 15:39
Copy link
Contributor

@connorlindsey connorlindsey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we considered dropping zustand for tanstack-store after using it for in-app-messages? I'm not strongly for it given how many changes we're already having to make here but maybe worth exploring.

@MikeCarbone
Copy link
Contributor Author

@connorlindsey Re: tanstack-store. Chris and I talked about it but we figured it was out of scope for now. I'm a big tanstack fan, the idea sounds nice! But let's revisit that another time

@MikeCarbone MikeCarbone changed the base branch from main to next-react-19-support February 26, 2025 16:57
@MikeCarbone MikeCarbone merged commit 0fc5f2d into next-react-19-support Feb 26, 2025
7 checks passed
@MikeCarbone MikeCarbone deleted the mike-kno-7523-2-js-support-react-19-in-react-sdks branch February 26, 2025 16:57
@MikeCarbone MikeCarbone mentioned this pull request Feb 26, 2025
MikeCarbone added a commit that referenced this pull request Mar 12, 2025
* [JS] Support React 19 in React SDKs (#419)

* removes react-popper dependency

* allow react 19

* upgrades zustand

* merge

* fixes render loop bug

* adjusts version number, removes placeholder

* undo example changes for this branch

* Better URL in comment

* fixes zustand implementation

* matches types on main

* Use new store

* merges in examples

* Cleanup CRA example

* fixes docs to remove zustand requirement

* Tests pass locally

* fixes dev dependency issues

* runs lint

* runs format

* remove unused dependency

* adds setup env variable

* clean up PR

* Improves selector typing and validates that it works

* runs formatter

* comment removes unnecessary info

* Better import and comments

* rips out rerender hack

* better styling setup

* updates to match main and easier merge

* run lint and format

* Updates a few readmes

* Create red-owls-jog.md

* adds version bumps for dependent packages and adds migration guide

* adds package specific upgrade guides

* updates upgrade guide to be more specific

* better formatting on upgrade guide

* downgrade zustand to support react 16

* undo manual version bump

* update guides and small PR feedback updates

* updates docs examples to stick with useNotificationStore

* adds links to upgrade guides

* fix(kno-7523): fixes separation of zustand vanilla and react (#429)

* fixes type handling

* testing new behavior

* lint and format

* Removes upgrade guide and validated store

* remove console logs

* removes test data

* fix(kno-7971): adds autoRegister to useEffect deps (#437)

* fix(kno-7523): fixes bad returns from useNotificationStore (#439)

* fix(kno-7523): fixes bad returns from useNotificationStore

* adds better types and comments:

* fixes hook name

* adds tests

* bumps telegraph component versions in nextjs example

* align turbo

* lock eslint-config-turbo resolution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants