v8.0.0-alpha.0 #1824
Replies: 4 comments 4 replies
-
Which version of react and react-dom should I install to try this out? I've installed react@next and react-dom@next, which gave me these: I still get the following error when starting the app: I have these redux versions: |
Beta Was this translation helpful? Give feedback.
-
That's difficult unfortunately, large enterprise app :)
I see from the code that this warnings gets thrown if React.startTransition
is defined. And I also see that React.startTransition is defined in my
version of React:
/./node_modules/react/cjs/react.development.js,with ReactVersion set
to '18.0.0-5fa4d79b0-20211008'
Do you have a different React version number I could try?
…On Sat, Oct 9, 2021 at 1:39 AM Mark Erikson ***@***.***> wrote:
Hmm. That... *ought* to work as far as I know :) Can you put up the repo?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1824 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABT6D6ZOAWVHZ24GG6GRRDUF56L3ANCNFSM5FH4UK4A>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Beta Was this translation helpful? Give feedback.
-
Yup, that did the trick. Most things seem to just work, and some things
feel snappier (might be imagining things tho...).
There does seem to be some subtle changes in behavior tho, so I will have
to do some digging before we can eventually upgrade.
Anyway, very cool that there now is a viable upgrade path for React Redux,
thanks :)
…On Sat, Oct 9, 2021 at 5:22 PM Mark Erikson ***@***.***> wrote:
Oh, you know what the issue probably is? React has both "alpha" and
"experimental" builds, and useSyncExternalStore only exists in the
"experimental" builds. You need one of those. You can use the experimental
tag, and as of right now the latest experimental version is
0.0.0-experimental-5fa4d79b0-20211008.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1824 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABT6D6VSOYTNFTLQ5VVSKTUGBM4TANCNFSM5FH4UK4A>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Beta Was this translation helpful? Give feedback.
-
Seem to be some smaller timing issues related to rendering and store updates. Keep in mind that this is a fairly large app, with sagas and a fair amount of slightly complicated rendering logic. Haven’t started really looking into making it work properly yet, just trying it out a bit.
Is the expectation that things will work exactly as before? Using ReactDOM.createRoot btw, and the app is entirely StrictMode compatible.
… On 10 Oct 2021, at 16:42, Mark Erikson ***@***.***> wrote:
Cool. Can you add any further details on what "subtle changes in behavior" you're seeing?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Beta Was this translation helpful? Give feedback.
-
This is the initial alpha preview release for React-Redux v8.
This alpha release reworks
useSelector
andconnect
for compatibility with React 18, rewrites the React-Redux codebase to TypeScript (obsoleting use of@types/react-redux
), modernizes build output, and removes the deprecatedconnectAdvanced
API and thepure
option forconnect
.Overview and Compatibility
This alpha release is intended for initial compatibility testing with React 18 and TypeScript. For general discussion of this release, see the associated thread in the Discussions section.
Our public API is still the same (
connect
anduseSelector/useDispatch
), all of our tests pass, and apps should run okay. It's very possible that the only migration needed is to bump the package version.However, it's likely that there will be types breakage due to the TypeScript migration, and runtime bugs are also possible due to the amount of internal refactoring and changes.
React-Redux now requires the new experimental
useSyncExternalStore
API in React 18. This release is using the "shim" package which backfills that API in earlier React versions, and currently lists'react': '^16 || ^17 || 18'
as its acceptable peer dependencies, so in theory it could run with React 16 and 17. However, we're planning to remove use of the shim and have a hard dependency on React 18 by the time version 8.0 goes final, so you are enouraged to try out this build with an "experimental" build of React 18 that containsuseSyncExternalStore
, such as version0.0.0-experimental-7d38e4fd8-20210930
, and follow the React 18 upgrade instructions.React 18 will be introducing new APIs related to SSR and hydration, and React-Redux will likely need further updates to support those. This release stubs out the
getServerSnapshot
argument touseSyncExternalStore
- we'll tackle this in a future alpha release.Changelog
TypeScript Migration
The React-Redux library source has always been written in plain JS, and the community maintained the TS typings separately as
@types/react-redux
.We've (finally!) migrated the React-Redux codebase to TypeScript, using the existing typings as a starting point. We've tried to maintain the same external type signatures as much as possible, but there will most likely be some compile breakages from the changes, and we may have missed some bits along the way. Please file issues with any apparent TS-related problems so we can review them.
The TS migration was a great collaborative effort, with many community members contributing migrated files. Thank you to everyone who helped out!
As part of the process, we also updated the repo to use Yarn 2, copied the typetests files from DefinitelyTyped and expanded them, and improved our CI setup to test against multiple TS versions.
React 18 Compatibility
Per the React 18 announcement overview, React 18 will include new capabilities like automatic render batching and opt-in support for "concurrent rendering". In order for external state libraries like Redux to take advantage of those, we need to use the new
useSyncExternalStore
API to let React better coordinate renders caused by external updates.We've reworked both
connect
anduseSelector
to calluseSyncExternalStore
internally. This process is purely internal refactoring, and should require no changes to your own code.Early performance benchmarks show parity with React-Redux v7.2.5 for both
connect
anduseSelector
, so we do not anticipate any meaningful performance regressions.Modernized Build Output
We've always targeted ES5 syntax in our published build artifacts as the lowest common denominator. Even the "ES module" artifacts with
import/export
keywords still were compiled to ES5 syntax otherwise.With IE11 now effectively dead and many sites no longer supporting it, we've updated our build tooling to target a more modern syntax equivalent to ES2017, which shrinks the bundle size slightly.
If you still need to support ES5-only environments, please compile your own dependencies as needed for your target environment.
Removal of Legacy APIs
We announced in 2019 that the legacy
connectAdvanced
API would be removed in the next major version, as it was rarely used, added internal complexity, and was also basically irrelevant with the introduction of hooks. As promised, we've removed that API.We've also removed the
pure
option forconnect
, which forced components to re-render regardless of whether props/state had actually changed if it was set tofalse
. This option was needed in some cases in the early days of the React ecosystem, when components sometimes relied on external mutable data sources that could change outside of rendering. Today, no one writes components that way, the option was barely used, and React 18'suseSyncExternalStore
strictly requires immutable updates. So, we've removed thepure
flag.Given that both of these options were almost never used, this shouldn't meaningfully affect anyone.
Changes
Due to the TS migration effort and number of contributors, this list covers just the major changes:
v7.2.4...v8.0.0-alpha.0
This discussion was created from the release v8.0.0-alpha.0.
Beta Was this translation helpful? Give feedback.
All reactions