Skip to content

Stable v3 & React 16 compat#658

Merged
gregberge merged 6 commits into
masterfrom
react-16
Oct 10, 2017
Merged

Stable v3 & React 16 compat#658
gregberge merged 6 commits into
masterfrom
react-16

Conversation

@gregberge

Copy link
Copy Markdown
Collaborator

This PR is a first step to be compatible with React 16, some tests are not passing. I tried to investigate but I need help.

@gregberge

Copy link
Copy Markdown
Collaborator Author

I thought it was related to enzyme and update issue but I tried with pure ReactDom.render and I have the same issues. Looks like react-deep-force-update or react-proxy is not compatible with React 16. @gaearon do you have an idea?

@gaearon

gaearon commented Oct 7, 2017

Copy link
Copy Markdown
Owner

Is it certainly using the very latest version of react-deep-force-update?

@gregberge

Copy link
Copy Markdown
Collaborator Author

@gaearon yes 😕

@gregberge

Copy link
Copy Markdown
Collaborator Author

@gaearon I dove into react-deep-force-update and it looks like stateNode is not updated.

https://github.com/gaearon/react-deep-force-update/blob/89506f42004843bd7297d44fdbd535fa2c9735cc/src/index.js#L83-L86

I think node of type "HostComponent" are not updated. How to force an update of these nodes?

@gregberge

Copy link
Copy Markdown
Collaborator Author

@gaearon problem occurs only with stateless functional components, they are not updated and the function is not called. If I switch it by a class based component, it works.

@gregberge

Copy link
Copy Markdown
Collaborator Author

@gaearon also I used the react-deep-force-update proposed in gaearon/react-deep-force-update#9. I updated code, if you want to investigate, just switch to my PR and run jest --watch test/HotContainer.dev.test.js. If we make this test pass, it is good.

@gregberge gregberge force-pushed the react-16 branch 3 times, most recently from 6531c0e to f4af29d Compare October 9, 2017 21:43
@gregberge

Copy link
Copy Markdown
Collaborator Author

@gaearon I finally found the problem, in the following case, App will not be reloaded because element instance is not recreated. It was the case in React 15. I think it is a minor regression but it has to be noticed.

const App = () => <div />
const element = <App />
ReactDOM.render(<HotContainer>{element}</HotContainer>, main)

@ntucker

ntucker commented Oct 9, 2017

Copy link
Copy Markdown

Thanks for working vigilantly on React 16 compatibility @neoziro ! :)

@gregberge

Copy link
Copy Markdown
Collaborator Author

@ntucker I try 🙂

@gregberge gregberge changed the title feat: React 16 compatibility Stable v3 & React 16 compat Oct 10, 2017
@gregberge gregberge merged commit 5973747 into master Oct 10, 2017
@gregberge gregberge deleted the react-16 branch October 10, 2017 19:19
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

Successfully merging this pull request may close these issues.

3 participants