resize every time it renders
This commit is contained in:
parent
8af1e69460
commit
f8556c30a5
2 changed files with 2 additions and 12 deletions
|
@ -62,7 +62,7 @@ const ExploreMaps = {
|
|||
ReactDOM.render(
|
||||
React.createElement(Maps, exploreObj),
|
||||
document.getElementById('explore')
|
||||
)
|
||||
).resize()
|
||||
|
||||
if (cb) cb()
|
||||
Metamaps.Loading.hide()
|
||||
|
|
|
@ -17,17 +17,7 @@ class Maps extends Component {
|
|||
window && window.addEventListener('resize', this.resize)
|
||||
this.resize()
|
||||
}
|
||||
|
||||
componentDidUpdate(oldProps) {
|
||||
const { maps, user, currentUser } = this.props
|
||||
const oldMaps = oldProps.maps
|
||||
const oldUser = oldProps.user
|
||||
const oldCurrentUser = oldProps.currentUser
|
||||
const numCards = maps.length + (user || currentUser ? 1 : 0)
|
||||
const oldNumCards = oldMaps.length + (oldUser || oldCurrentUser ? 1 : 0)
|
||||
if (numCards !== oldNumCards) this.resize()
|
||||
}
|
||||
|
||||
|
||||
componentWillUnmount() {
|
||||
window && window.removeEventListener('resize', this.resize)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue