aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-30 16:33:48 +0100
committerChocobozzz <me@florianbigard.com>2020-11-30 16:33:48 +0100
commit617f4f5cb2ac44df481851ff4165a79820b6b146 (patch)
tree61e7bd02411b5fb34529e6b788dfe6d3fe499fe1 /client/src/app/shared
parent6cddd97d1d441da9afaeca263a35a9f4a2fc0317 (diff)
downloadPeerTube-617f4f5cb2ac44df481851ff4165a79820b6b146.tar.gz
PeerTube-617f4f5cb2ac44df481851ff4165a79820b6b146.tar.zst
PeerTube-617f4f5cb2ac44df481851ff4165a79820b6b146.zip
Fix scroll check in infinite scroller directive
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/shared-main/angular/infinite-scroller.directive.ts13
1 files changed, 7 insertions, 6 deletions
diff --git a/client/src/app/shared/shared-main/angular/infinite-scroller.directive.ts b/client/src/app/shared/shared-main/angular/infinite-scroller.directive.ts
index d2cf53227..dc212788a 100644
--- a/client/src/app/shared/shared-main/angular/infinite-scroller.directive.ts
+++ b/client/src/app/shared/shared-main/angular/infinite-scroller.directive.ts
@@ -1,11 +1,11 @@
1import { fromEvent, Observable, Subscription } from 'rxjs' 1import { fromEvent, Observable, Subscription } from 'rxjs'
2import { distinctUntilChanged, filter, map, share, startWith, throttleTime } from 'rxjs/operators' 2import { distinctUntilChanged, filter, map, share, startWith, throttleTime } from 'rxjs/operators'
3import { AfterContentChecked, Directive, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core' 3import { AfterViewChecked, Directive, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'
4 4
5@Directive({ 5@Directive({
6 selector: '[myInfiniteScroller]' 6 selector: '[myInfiniteScroller]'
7}) 7})
8export class InfiniteScrollerDirective implements OnInit, OnDestroy, AfterContentChecked { 8export class InfiniteScrollerDirective implements OnInit, OnDestroy, AfterViewChecked {
9 @Input() percentLimit = 70 9 @Input() percentLimit = 70
10 @Input() autoInit = false 10 @Input() autoInit = false
11 @Input() onItself = false 11 @Input() onItself = false
@@ -24,13 +24,14 @@ export class InfiniteScrollerDirective implements OnInit, OnDestroy, AfterConten
24 this.decimalLimit = this.percentLimit / 100 24 this.decimalLimit = this.percentLimit / 100
25 } 25 }
26 26
27 ngAfterContentChecked () { 27 ngAfterViewChecked () {
28 if (this.checkScroll) { 28 if (this.checkScroll) {
29 this.checkScroll = false 29 this.checkScroll = false
30 30
31 console.log('Checking if the initial state has a scroll.') 31 // Wait HTML update
32 32 setTimeout(() => {
33 if (this.hasScroll() === false) this.nearOfBottom.emit() 33 if (this.hasScroll() === false) this.nearOfBottom.emit()
34 })
34 } 35 }
35 } 36 }
36 37