move 3 Subscribables into single Computable

This commit is contained in:
djmaze 2022-01-05 11:46:08 +01:00
parent 1d96160a38
commit 70093e4d23

View file

@ -89,8 +89,6 @@ export const MessageUserStore = new class {
listLoading: false,
// Happens when message(s) removed from list
listIsIncomplete: false,
// when this.listLoading || this.listIsIncomplete
listIsLoading: false,
selectorMessageSelected: null,
selectorMessageFocused: null,
@ -112,13 +110,12 @@ export const MessageUserStore = new class {
// Computed Observables
addComputablesTo(this, {
/*
listIsLoading: () => {
const value = this.listLoading() | this.listIsIncomplete();
$htmlCL.toggle('list-loading', value);
return value;
},
*/
listPageCount: () => Math.max(1, Math.ceil(this.listCount() / SettingsUserStore.messagesPerPage())),
mainMessageListSearch: {
@ -164,14 +161,6 @@ export const MessageUserStore = new class {
// Subscribers
addSubscribablesTo(this, {
listIsLoading: value => $htmlCL.toggle('list-loading', value),
listLoading: value =>
this.listIsLoading(value || this.listIsIncomplete()),
listIsIncomplete: value =>
this.listIsLoading(value || this.listLoading()),
message: message => {
clearTimeout(MessageSeenTimer);
if (message) {