diff options
-rw-r--r-- | client/components/cards/cardDetails.js | 8 | ||||
-rw-r--r-- | client/components/mixins/infiniteScrolling.js | 7 | ||||
-rw-r--r-- | client/components/sidebar/sidebar.js | 4 |
3 files changed, 8 insertions, 11 deletions
diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index bfe9f755..f6cd4140 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -8,8 +8,11 @@ BlazeComponent.extendComponent({ }, calculateNextPeak() { - const altitude = this.find('.js-card-details').scrollHeight; - this.callFirstWith(this, 'setNextPeak', altitude); + const cardElement = this.find('.js-card-details'); + if (cardElement) { + const altitude = cardElement.scrollHeight; + this.callFirstWith(this, 'setNextPeak', altitude); + } }, reachNextPeak() { @@ -21,6 +24,7 @@ BlazeComponent.extendComponent({ this.isLoaded = new ReactiveVar(false); this.parentComponent().showOverlay.set(true); this.parentComponent().mouseHasEnterCardDetails = false; + this.calculateNextPeak(); }, scrollParentContainer() { diff --git a/client/components/mixins/infiniteScrolling.js b/client/components/mixins/infiniteScrolling.js index 0afb33f9..eb02b76f 100644 --- a/client/components/mixins/infiniteScrolling.js +++ b/client/components/mixins/infiniteScrolling.js @@ -17,11 +17,6 @@ Mixins.InfiniteScrolling = BlazeComponent.extendComponent({ this._nextPeak = Infinity; }, - // To be overwritten by consumers of this mixin - reachNextPeak() { - - }, - events() { return [{ scroll(evt) { @@ -29,7 +24,7 @@ Mixins.InfiniteScrolling = BlazeComponent.extendComponent({ let altitude = domElement.scrollTop + domElement.offsetHeight; altitude += peakAnticipation; if (altitude >= this.callFirstWith(null, 'getNextPeak')) { - this.callFirstWith(null, 'reachNextPeak'); + this.mixinParent().callFirstWith(null, 'reachNextPeak'); } }, }]; diff --git a/client/components/sidebar/sidebar.js b/client/components/sidebar/sidebar.js index 15a4ce44..e414c1f9 100644 --- a/client/components/sidebar/sidebar.js +++ b/client/components/sidebar/sidebar.js @@ -94,9 +94,7 @@ BlazeComponent.extendComponent({ }, events() { - // XXX Hacky, we need some kind of `super` - const mixinEvents = this.getMixin(Mixins.InfiniteScrolling).events(); - return [...mixinEvents, { + return [{ 'click .js-hide-sidebar': this.hide, 'click .js-toggle-sidebar': this.toggle, 'click .js-back-home': this.setView, |