Switch from ko.computed to ko.pureComputed

This should provide performance and memory benefits over regular computed observables
This commit is contained in:
djmaze 2021-12-31 13:30:05 +01:00
parent ac2238a23f
commit 954de06f86
18 changed files with 55 additions and 37 deletions

View file

@ -1,5 +1,6 @@
import ko from 'ko';
import { isArray } from 'Common/Utils';
import { koComputable } from 'External/ko';
/*
oCallbacks:
@ -28,8 +29,8 @@ export class Selector {
sItemFocusedSelector
) {
this.list = koList;
this.listChecked = ko.computed(() => this.list.filter(item => item.checked())).extend({ rateLimit: 0 });
this.isListChecked = ko.computed(() => 0 < this.listChecked().length);
this.listChecked = koComputable(() => this.list.filter(item => item.checked())).extend({ rateLimit: 0 });
this.isListChecked = koComputable(() => 0 < this.listChecked().length);
this.focusedItem = koFocusedItem || ko.observable(null);
this.selectedItem = koSelectedItem || ko.observable(null);