mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
Fix card infinite scrolling on card activities
I imagine blaze-component changed their Mixins API since I written this code. We need some tests to avoid this kind of regressions when updating dependencies! Fixes #420
This commit is contained in:
parent
8c01d51577
commit
46747b01fb
3 changed files with 8 additions and 11 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
}
|
||||
},
|
||||
}];
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue