-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Investigation: try React-Redux v7 / v8 with React 18 alpha #1732
Comments
Note to folks trying — if you have StrictMode on, please test both with StrictMode and without it. This is to see if some issues only occur in StrictMode. (StrictMode has gotten “stricter.”) |
We actually have tests for StrictMode in our suite already, so it should be good to test at least the basics here. |
Okay. First issue here is that there's this new "Strict Effects" thing which is enabled if you're using So, we'd need to figure out how to do a React 18 upgrade for our tests, which I assume would mean something with React Testing Library since that's doing the rendering? |
If you're asking about Testing Library compatibility, you may want to subscribe to testing-library/react-testing-library#925 (proposed as an alpha). |
I have a side project that used to React-Redux v7.2.4, I'd like to try it if React 18 alpha working on CRA v4.0.3. |
Comment from the React team on plans for helping the community do updates:
|
Mobx has a PR going that's tracking some similar status checks for React 18. Worth keeping an eye on that: |
Hi @markerikson! I have something interesting for you) I have a repository with react 18 + SSR + redux for UI state. There is an interactive demo — http://158.101.223.0:5000/ As you can see, there is a button "Patch query string". If you'll click this button, the UI state in a redux-store will be updated with new Date().toString() There is a source code. Top part of the page has a component, that has a subscription to the redux-store vis useSelector. So, if you will open the demo with a query param strict=true, the whole app will be wrapped with component. If there is no strict query param — without it. Click to the button, that changes the query string works perfectly in strict mode and without it. But, it works in production build only. If you will clone the repository, exec Actually, I can not understand, what is the difference between develop and production build in case of redux/react-redux. May be it is because of react? I understand, the project is quite big. But I've tried to make it easy to repeat the problem. Other stuff from that repo is not so important, as think) |
Example of StrictMode + createRoot breaking it, per request from reactwg/react-18#19 (comment): https://codesandbox.io/s/serverless-wood-uouyy?file=/src/index.js |
And copying over some excellent detective work from @Andarist at reactwg/react-18#19 (reply in thread) :
|
https://etg.dek.im https://github.com/serprex/openEtG works okay after updating to react-redux 8.0.0-beta.3 & react 18.0 Code doesn't use any hooks |
React-Redux v8 is out, so I think we can call this done :) |
React 18 is now available as preview alpha releases (per https://reactjs.org/blog/2021/06/08/the-plan-for-react-18.html ).
The React team has put together a Working Group discussion forum to describe the changes in React 18 in more detail: https://github.com/reactwg/react-18/discussions
Looking at that forum, there's several issues that may be relevant to React-Redux in some way:
I'd like to have some folks start trying out React-Redux v7 with React 18 alpha, and report any interesting findings. We could potentially use some of the example apps from the Redux tutorials, and any of the example CodeSandboxes linked in our docs.
You would need to:
React.createRoot()
per instructionsWe're interested in seeing examples and comparisons with both
connect
anduseSelector
.It would also be worth cloning the React-Redux repo, and updating our React devDep to run our tests against the alphas.
The React team has reported that a brief test of a couple Redux-based apps combined with
createRoot + StrictMode
did not appear to be working correctly - in particular, no re-rendering happening despite actions being dispatched.It's very possible that Strict Effects running effects callbacks more than once is causing problems with subscriptions.
We'd appreciate any feedback reports!
Please provide this info:
The text was updated successfully, but these errors were encountered: