Run binding when isLoading changes

This commit is contained in:
RMidhunSuresh 2022-08-15 15:00:31 +05:30
parent 4a62cdb8fb
commit 8e2838264f
2 changed files with 5 additions and 3 deletions

View File

@ -38,6 +38,7 @@ export class GapTile extends SimpleTile {
} catch (err) { } catch (err) {
console.error(`room.fillGap(): ${err.message}:\n${err.stack}`); console.error(`room.fillGap(): ${err.message}:\n${err.stack}`);
this._error = err; this._error = err;
this._loading = false;
this.emitChange("error"); this.emitChange("error");
if (err instanceof ConnectionError) { if (err instanceof ConnectionError) {
/* /*

View File

@ -30,16 +30,17 @@ export class GapView extends TemplateView {
isAtTop: vm => vm.isAtTop, isAtTop: vm => vm.isAtTop,
}; };
return t.li({ className }, [ return t.li({ className }, [
t.map(vm => vm.error, t.map(vm => vm.isLoading,
(error, t, vm) => { (isLoading, t, vm) => {
let elements; let elements;
const error = vm.error;
if (error) { if (error) {
elements = [t.strong(() => error.message)]; elements = [t.strong(() => error.message)];
if (error.showSpinner) { if (error.showSpinner) {
elements.unshift(spinner(t)); elements.unshift(spinner(t));
} }
} }
else if (vm.isLoading) { else if (isLoading) {
elements = [spinner(t), t.span(vm.i18n`Loading more messages …`)]; elements = [spinner(t), t.span(vm.i18n`Loading more messages …`)];
} }
else { else {