Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rex Dri
Rex Dri
Commits
d4e941e5
Commit
d4e941e5
authored
Sep 15, 2018
by
Florent Chehab
Browse files
Bug corrected and better controll on rerender in mycomponent
parent
9e4abdc1
Changes
2
Hide whitespace changes
Inline
Side-by-side
frontend/src/components/MyComponent.js
View file @
d4e941e5
...
...
@@ -121,9 +121,17 @@ class MyComponent extends Component {
shouldComponentUpdate
(
nextProps
,
nextState
)
{
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
;
}
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
;
}
...
...
frontend/src/components/university/modules/UniversityGeneral.js
View file @
d4e941e5
...
...
@@ -37,7 +37,7 @@ function renderCore(rawModelData, classes, outsideData) {
return
(
<
div
>
<
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
!=
''
?
<
img
style
=
{{
width
:
"
100%
"
}}
src
=
{
logo
}
/
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment