From f8556c30a52893d11502644ee0a2ad82e800abd4 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Fri, 21 Oct 2016 19:10:28 -0400 Subject: [PATCH] resize every time it renders --- frontend/src/Metamaps/Views/ExploreMaps.js | 2 +- frontend/src/components/Maps/index.js | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/frontend/src/Metamaps/Views/ExploreMaps.js b/frontend/src/Metamaps/Views/ExploreMaps.js index c04346cc..c37c38db 100644 --- a/frontend/src/Metamaps/Views/ExploreMaps.js +++ b/frontend/src/Metamaps/Views/ExploreMaps.js @@ -62,7 +62,7 @@ const ExploreMaps = { ReactDOM.render( React.createElement(Maps, exploreObj), document.getElementById('explore') - ) + ).resize() if (cb) cb() Metamaps.Loading.hide() diff --git a/frontend/src/components/Maps/index.js b/frontend/src/components/Maps/index.js index 51bd1acc..e6fb3c89 100644 --- a/frontend/src/components/Maps/index.js +++ b/frontend/src/components/Maps/index.js @@ -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) }