Commit d4e941e5 authored by Florent Chehab's avatar Florent Chehab
Browse files

Bug corrected and better controll on rerender in mycomponent

parent 9e4abdc1
...@@ -121,9 +121,17 @@ class MyComponent extends Component { ...@@ -121,9 +121,17 @@ class MyComponent extends Component {
shouldComponentUpdate(nextProps, nextState) { shouldComponentUpdate(nextProps, nextState) {
if (this.nextProps && typeof this.nextProps.visible != 'undefined' && !this.nextProps.visible) { if (this.nextProps && typeof this.nextProps.visible != 'undefined' && !this.nextProps.visible) {
// don't rerender components that are not visible. // don't rerender components that won't be visible.
return false; return false;
} }
if (this.props.visible === false && !this.nextProps) {
// don't rerender components if it is still not visible
return false;
}
// if (this.nextProps && typeof this.nextProps.visible != 'undefined' && this.nextProps.visible) {
// // render if nextprops should be visible
// return true;
// }
return true; return true;
} }
......
...@@ -37,7 +37,7 @@ function renderCore(rawModelData, classes, outsideData) { ...@@ -37,7 +37,7 @@ function renderCore(rawModelData, classes, outsideData) {
return ( return (
<div> <div>
<Grid container spacing={16} direction='row'> <Grid container spacing={16} direction='row'>
<Grid item xs={4} alignItems='center' style={{ display: 'inline-flex' }}> <Grid item xs={4} style={{ display: 'inline-flex', alignItems: 'center' }}>
{ {
logo != '' ? logo != '' ?
<img style={{ width: "100%" }} src={logo} /> <img style={{ width: "100%" }} src={logo} />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment