-
Notifications
You must be signed in to change notification settings - Fork 114
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
Flux Instance regression from v2.13.1 to v3.x #111
Comments
A test case would be greatly appreciated! It seems like there are several context-related bugs with 3.x that haven't been resolved yet since most people (including myself) were stuck on React 0.12 / Flummox 2.x until React Router updated for 0.13 compatibility. |
Haha, me too! :) I just upgraded last night. Luckily, with v0.2.x, React v0.13 + Router works great with it still! I'll work on a test-case after I get off today... |
Okay, I believe I figured it out. Flummox 0.13 uses This only affects the top-level FluxComponent, which the Flux instance is not already part of context. It can be circumvented by either:
Because In the future, though, I'm starting to think we should deprecate the automatic child wrapping functionality. Kind of a shame, since for simple use cases (e.g. a single child) it provides a nice interface. But it seems to be causing more problems than its worth. The custom |
Oddly enough, I could've sworn I tried doing |
Just published 3.1.2 which fixes the existing test cases. I'll leave this issue open until you can confirm. |
Fixed it!! God bless you @acdlite! :) |
Another idea for future API could be the based around a higher-order component that came wrap the component as seen here: https://medium.com/@dan_abramov/mixins-are-dead-long-live-higher-order-components-94a0d2f9e750 I think this looks nicer than providing render as a prop and encourages reusability. |
Based on my gist that creates a FluxApp.createContainer = function(Component, props) {
return React.createClass({
displayName: `${Component.displayName}Container`,
render() {
return (
<FluxContainer component={Component} {...this.props} {...props} />
);
},
});
}; This way, I can do I'm not sure how this can get any cleaner or be more "higher-order". The thing is, for only rendering when props are loaded, the |
Yeah, I'm unconvinced that a higher-order component is a better interface. But I'd accept a PR that adds it as an alternative to FluxComponent. It should be straightforward to implement using Let's discuss that in a separate issue, though. |
Is it possible that this issue was being caused by people not passing context to super() in their constructors? |
Maybe? I remember testing the value of |
You may remember my gist for having a custom
<FluxContainer />
inv2.13.1
that is slightly modeled after<FluxComponent render={...} />
in v3.I updated my
package.json
today and got this error:(Of course, it looked related to #85, but that issue is using
v2.13.1
, so it must be unrelated)As far as I can tell, there's a discrepancy with the codebase moving from
React.createClass
toclass X extends React.Component
and assigning props/statics in a different way.If you're not aware of this issue, let me know & I'll see about creating a test-case!
The text was updated successfully, but these errors were encountered: