redfin / react-server

:rocket: Blazing fast page load and seamless navigation.
https://react-server.io/
Apache License 2.0
3.89k stars 184 forks source link

Upgrade React to v16.0.0 #965

Closed salehhamadeh closed 6 years ago

salehhamadeh commented 6 years ago

This PR only upgrades React to v16.0.0. It does not use any new features, aside from changing React.render to React.hydrate in ClientController. I thought about using React.renderToNodeStream instead of React.renderToString in renderMiddleware.getElements, but I was not sure what is the best way to do it. I was thinking of having a stream for every RootElement that are all read and poured into a higher-level stream. I do not know if this will work. If you have ideas let me know, and I can either include it in this PR or in a separate one.

I used react-codemod (https://github.com/reactjs/react-codemod) to refactor PropTypes and React.createClass. I tested all react-server-test-pages. The only test page that behaves differently is the Error Logging Tests Page. Instead of the buttons logging errors and staying on the page, they are completely removed. This is the expected behavior since the introduction of error boundaries in React 16 https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html

CLAassistant commented 6 years ago

CLA assistant check
All committers have signed the CLA.

salehhamadeh commented 6 years ago

Bo and I talked offline. We decided to update react-hot-loader to v3.1.1. Server-side hot reloading will continue to work, so making a change and refreshing the page will show the changes. However, client-side hot reloading is broken because React 16 does not have ReactMount, which react-hot-loader v1 depended on. I will open an issue for the broken client-side hot module replacement.