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

React-Redux v9 Roadmap: packaging, updated defaults, and improving RSC compat #2026

Closed
markerikson opened this issue Jun 6, 2023 · 0 comments
Milestone

Comments

@markerikson
Copy link
Contributor

We're currently working on major versions for all of the Redux-related packages: RTK 2.0, Redux core 5.0, Reselect 5.0, and Redux-Thunk 3.0.

The primary driver for this is updating package formats for full ESM/CJS compatibility, as well as modernizing JS output.

I originally was not planning to publish a new major for React-Redux. It's been pretty stable ever since we released v8, with only a few minor TS types tweaks.

HOWEVER, we've decided it's worth doing a new major version after all.

One motivation is to address potential compat issues with React Server Components. Specifically, it seems that just calling React.createContext() in an RSC environment throws errors. React-Redux exports the ReactReduxContext singleton instance, and it's created on initialization as soon as you import from the package. This means importing one of our hooks throws an error inside of RSCs, and RTK Query's React-using createApi method tries to generate hooks.

We've got an idea for working around that ( see #2025 ), but it's probably still worth coming up with a fuller solution.

Additionally, it is worth doing the same ESM/CJS packaging changes we've done in our other libraries.

Finally, React 18 has been out for a year. When we shipped v8, we defaulted to using the useSyncExternalStore "shim" package for compatibility with React 16-17. The shim adds some extra bytes to all consumers, even if you're using React 18. We can swap that now to only use the actual uSES hook, and require React 18 as a minimum version.

Based on that, the only potentially "breaking" changes would be:

  • If you're importing and using ReactReduxContext, that export might go away depending on how we end up addressing the context compat question. (In that case, we'd likely end up providing some kind of getReactReduxContext() function as a replacement for that use case.)
  • If you're on React 16-17, you'd need to upgrade to React 18 to use React-Redux v9

But other than that, this ought to be a simple "bump the version and move on" upgrade.

@markerikson markerikson added this to the 9.0 milestone Jun 6, 2023
@markerikson markerikson pinned this issue Jun 6, 2023
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

No branches or pull requests

2 participants
@markerikson and others