-
Notifications
You must be signed in to change notification settings - Fork 50
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
Align with autobinding changes in React master #37
Comments
@akorchev Would you like to take a look at this? |
Relevant part starts with https://github.com/facebook/react/pull/5550/files#diff-d57db055bf32620520a16ab16dc6ec2fL702 We should support both old and new style. |
I will take a look. Not sure how to test it though. I guess I will check the current implementation around __reactAutoBindMap. |
Testing is tricky. I think our best bet is to test it in a branch with existing tests (but using 0.15 alpha), later transition to testing with 15 in master when it’s stable. |
I could do that but I don't understand what __reactAutoBindMap originally did. Are there any tests in react-proxy that rely on that behavior? |
I think if you remove the relevant code then |
To clarify, this: react-proxy/src/bindAutoBindMethods.js Lines 13 to 54 in 4bdc8b3
is pretty much copy-pasted from React source. We just need to copy-paste the new version of these methods and switch based on the instance field we detect. |
Yep. Pretty much everything fails after upgrading to 0.15 alpha. Will see If I can fix that. |
Thanks for taking a look. If it doesn’t work out, ping me and I can try to help. |
Is it just me or this code never runs in tests? https://github.com/gaearon/react-proxy/blob/master/src/createClassProxy.js#L160 When I ran them against 0.15 (in this branch) bindAutoBindMethods never runs. Which makes me think that the tests fail for other reasons. The tests first failed with with this stack trace:
It seems createReactRootID now needs a parameter. After calling it with an argument I ended up with Could there be a rendering problem in the tests with 0.15? |
The tests now pass in 0.15. However to make it work in 0.14 I need to somehow detect the react version because of this line: https://github.com/gaearon/react-proxy/blob/auto-bind/test/helpers/createShallowRenderer.js#L102 |
If it works in 0.15 we can just use it for testing instead (and modify shallow renderer code accordingly). I copied shallow renderer from React code and made a few tiny changes for my use case but it changed since then. |
So we can fix autobinding in 15, apply that fix to our master branch (which wouldn't really be tested but we'd know it works and be careful not breaking it) and release both 1.x and 2.x, and keep 15 branch around where we actually test with 15. When 15 is released, we can just use it in master tests instead. |
Ideally of course we should test multiple versions of React but ain’t nobody got time for that. |
Sounds like a plan. I will rename the branch to 0.15 and cherry-pick everything but package.json and the shallow renderer. OK? |
@gaearon too afraid to push before a review so opened two PRs. |
These look great. Can you verify whether they work with React master? I don't think this code changed since 0.15 alpha but still worth checking before we cut a release. |
The tests pass with React master. Out of curiosity what is the most efficient way to test against React master? I cloned the repo, built the repo and then copied it over node_modules/react/lib. There must be a better way. |
Maybe there is but that is what I do too. |
I usually do |
Manually tested, and this appears to be fixed. Much appreciated! |
Don't mention it. I am happy to help. |
There were some changes to autobinding internal field names.
We should support the new field names in master: facebook/react#5550
The text was updated successfully, but these errors were encountered: