fill gap tiles when they become visible

This commit is contained in:
Bruno Windels 2021-09-08 12:05:59 +02:00
parent 7578bfa3d9
commit e89f60bac0
3 changed files with 9 additions and 6 deletions

View file

@ -22,6 +22,7 @@ export class GapTile extends SimpleTile {
super(options);
this._loading = false;
this._error = null;
this._visible = false;
}
async fill() {
@ -47,6 +48,13 @@ export class GapTile extends SimpleTile {
return this._entry.edgeReached;
}
setVisible(isVisible) {
this._visible = isVisible;
if (this._visible && !this.isLoading) {
this.fill();
}
}
updateEntry(entry, params) {
super.updateEntry(entry, params);
if (!entry.isGap) {

View file

@ -54,15 +54,10 @@ limitations under the License.
}
.GapView {
visibility: hidden;
display: flex;
padding: 10px 20px;
}
.GapView.isLoading {
visibility: visible;
}
.GapView > :nth-child(2) {
flex: 1;
}

View file

@ -25,7 +25,7 @@ export class GapView extends TemplateView {
};
return t.li({className}, [
spinner(t),
t.div(vm.i18n`Loading more messages …`),
t.div(vm => vm.isLoading ? vm.i18n`Loading more messages …` : vm.i18n`Not loading!`),
t.if(vm => vm.error, t => t.strong(vm => vm.error))
]);
}