Speedup listChecked().length to hasChecked()

This commit is contained in:
the-djmaze 2022-09-09 10:02:40 +02:00
parent 7ec3d70c60
commit 47a861a243
8 changed files with 28 additions and 20 deletions

View file

@ -1,7 +1,7 @@
import ko from 'ko';
import { SettingsGet } from 'Common/Globals';
import { pInt } from 'Common/Utils';
import { addObservablesTo, koArrayWithDestroy } from 'External/ko';
import { koComputable, addObservablesTo, koArrayWithDestroy } from 'External/ko';
import Remote from 'Remote/User/Fetch';
export const ContactUserStore = koArrayWithDestroy();
@ -18,6 +18,12 @@ addObservablesTo(ContactUserStore, {
syncPass: ''
});
// Also used by Selector
ContactUserStore.hasChecked = koComputable(
// Issue: not all are observed?
() => !!ContactUserStore.find(item => item.checked())
);
/**
* @param {Function} fResultFunc
* @returns {void}