-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Core] remove context-pure mixin from components #2837
Comments
@hai-cea @oliviertassinari @shaurya947 , any idea? |
That's related to #1176.
|
IMO, we should treat |
@yongxu To be more precise. @oliviertassinari I agree that those are the 3 options. Do you have a gut feeling which option is best? I suppose a hybrid option between 1 and 2 is to change the @alitaheri Thoughts on any of this? |
Well as I've said before (and we all agreed) We should try to make our components as stateless as possible. let the users and HOCs handle state. and for context, Recompose is a very good answer. We can use it to handle most of our performance issues. But unfortunately we have to get rid of imperative methods and all the code duplication with theme handling before we can do this. I've been studying Recompose for quite a while now. I think it's the naswer to many of our problems (except imperative methods which we will have to proxy through somehow). Besides if theme is gathered by an HOC and passed down as prop we won't need this mixin anymore. and if we reduce state. many of the stateless components can use Recompose's |
@oliviertassinari @alitaheri What do you think the best strategy is to remove the context-pure dependency from these components? Should we simply remove it since we're moving to |
Eradicate 👊 💥 |
😈 |
That definitely sounds like the best strategy 👍. Then, we can use the chain order proposed by @alitaheri #3268. |
Sounds good, I'm gonna do a PR for the final remaining window-listenable components and then we can start removing this |
This mixin appears in many components, checking if
context.muiTheme
has changed.First of all, I do not see why this component is necessary besides supporting dynamic theme. This can be done by creating a new theme context instance, React will then tell it has been changed.
Moreover, Its appearance may significantly affect the performance since it does checking in
shouldComponentUpdate
every time react does reconciliation. Especially, this happens for every flat button and text field.Last, but may not relate to this issue, context-pure mixin uses
src/utils/shallow-equal.js
, the same function has been implemented as react addonreact-addons-shallow-compare
. I think we should remove it fromutils
.Here is the sublime search result:
Edit by @newoga (replaced @yongxu sublime search results with checklist)
The text was updated successfully, but these errors were encountered: