-
-
Notifications
You must be signed in to change notification settings - Fork 348
Prevent rendering #50
Comments
Sounds to me like a simple |
Thanks for your help @mweststrate 😃 I have to render my whole component three to let the components initialize and call the necessary store's methods. I guess I could use shouldComponentUpdate in all my "smart components" using the @observer but I don't even think that mobx-react check the component shouldComponentUpdate result before doing his own business. (Am I right?) |
We could call |
@andykog good point, that might make sense anyways. Or it might be confusing :) not entirely sure. Implementing should be pretty straight forward, although the original shouldComponentUpdate should be used, as mobx replaces it with its own implementation |
@mweststrate voting for keeping shouldComponentUpdate with it's original functionality (or at least providing an observer that respects manually written ones). |
Hi. This feature important for me too. My use case: Currently, I don't see any solutions without I tried @andykog tip, looks like it works. |
@lavrton: |
@mweststrate will it respect I am happy to use |
Investigated this issue. If you don't want components to be rerendered, this should be expressed in the state and addressed by using for example computed or other observables that are only updated once in a while. I hope that helps! |
Hi. You said I'm a bit confused. Isn't the point of MobX that we can create observables, that are used in render() change them as we like, and MobX automatically tells React when to rerun render()? What exactly is the anti-pattern you're describing here? |
@thunderkid I think the discussion is about |
Or we could implement componentWillReact return true/false to render or not ? |
Hey guys,
Is there currently any way to prevent rendering ?
I would need such a feature to optimize my server side rendering, let me explain how it works:
1/ I'm rendering my app in order to feed the stores (API call...)
2/ When all the stores are ready, I'm rendering my app a second time in order to get the final html
3/ I'm sending the html
With this feature I would be able to prevent the components rendering in the part 1/ for performance improvements ! : )
Do you think we could implement this feature ? I guess we may only have to add a condition in the shouldComponentUpdate lifecycle method ?
Thanks
The text was updated successfully, but these errors were encountered: