-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
RelayMutation getFragment method is static ? #394
Comments
Thanks for he heads up, @chandu0101. @voideanvalue might have thoughts on this, as he did most of the implementation for the current version of the |
An alternative to a custom class creator would be to try to avoid using inherited static properties. A possible API could be: // current
MyComponent.getFragment();
// alternative
Relay.getFragment(MyComponent); |
I'm also seeing this behavior in IE <= 10. The static method getFragment from RelayMutation does not get added to inherited components, which causes this:
to result in:
I'm currently able to work around this problem by calling getFragment on RelayMutation directly:
But this is less than ideal. I believe this is actually a Babel limitation in converting ES6 classes to IE <= 10 (static properties specifically don't seem to work), so I'm unsure at the moment what the best fix is. |
Thanks @gauravtiwari, I'd tried this already but with no luck. I think the problem is that the relay package has already been run through Babel by the time you get it via npm (as it should be), and so those plugins never have a chance to do their thing to RelayMutation.js. Those plugins would actually need to be used by relay's own build process in order for this to work. It's been several months since I messed with this, so please let me know if you took this approach and it worked for you. I should probably try using those plugins on a clone of relay to verify my own theory on the problem. |
@03eltond I see. No, it works for me with those plugins. I actually installed a couple, especially the transform ones. Yeah, give it a shot and it should work now 👍 |
Thanks for the input, everybody. I'm going to close this given @gauravtiwari's workaround, and also because the mutation API is changing dramatically for the better in Relay 2, so this problem should simply go away in the near future. Thanks once again! |
@gauravtiwari I'm running into the same issue with IE10, and I still cannot get it to work by using the 2 babel plugins that you mentioned, https://babeljs.io/docs/plugins/transform-class-properties/ and https://www.npmjs.com/package/babel-plugin-transform-es2015-classes Are you sure that it's working in IE10? Could you or someone provide more help? |
I fixed it myself with following code on Mutation class
I found it better, because I don't need to handle it outside of Mutation and I need to write it only once for every mutation :) Example:
|
looks like inheriting static members doesn't work in all browsers ? recently we(sclala.js devs) faced similar issue when upgrading to react 0.14 rc
scala-js/scala-js#1900
facebook/react#4836
react team reconsidering this change!, is relay team also working along same guidelines ? if not can we get an API
Relay.createMutation(options)
similar toRelay.createContainer
?The text was updated successfully, but these errors were encountered: