resize every time it renders

This commit is contained in:
Connor Turland 2016-10-21 19:10:28 -04:00
parent 8af1e69460
commit f8556c30a5
2 changed files with 2 additions and 12 deletions

View file

@ -62,7 +62,7 @@ const ExploreMaps = {
ReactDOM.render(
React.createElement(Maps, exploreObj),
document.getElementById('explore')
)
).resize()
if (cb) cb()
Metamaps.Loading.hide()

View file

@ -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)
}