mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Switch from ko.computed to ko.pureComputed
This should provide performance and memory benefits over regular computed observables
This commit is contained in:
parent
ac2238a23f
commit
954de06f86
18 changed files with 55 additions and 37 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import ko from 'ko';
|
||||
import { koComputable } from 'External/ko';
|
||||
|
||||
import { AbstractModel } from 'Knoin/AbstractModel';
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ export class FilterConditionModel extends AbstractModel {
|
|||
valueSecondError: false
|
||||
});
|
||||
|
||||
this.template = ko.computed(() => {
|
||||
this.template = koComputable(() => {
|
||||
const template = 'SettingsFiltersCondition';
|
||||
switch (this.field()) {
|
||||
case FilterConditionField.Body:
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ import { i18n, trigger as translatorTrigger } from 'Common/Translator';
|
|||
|
||||
import { AbstractModel } from 'Knoin/AbstractModel';
|
||||
|
||||
import { koComputable } from 'External/ko';
|
||||
|
||||
//import { mailBox } from 'Common/Links';
|
||||
|
||||
const
|
||||
|
|
@ -265,7 +267,7 @@ export class FolderModel extends AbstractModel {
|
|||
|
||||
type && 'mail' != type && folder.kolabType(type);
|
||||
|
||||
folder.messageCountAll = ko.computed({
|
||||
folder.messageCountAll = koComputable({
|
||||
read: folder.privateMessageCountAll,
|
||||
write: (iValue) => {
|
||||
if (isPosNumeric(iValue)) {
|
||||
|
|
@ -277,7 +279,7 @@ export class FolderModel extends AbstractModel {
|
|||
})
|
||||
.extend({ notify: 'always' });
|
||||
|
||||
folder.messageCountUnread = ko.computed({
|
||||
folder.messageCountUnread = koComputable({
|
||||
read: folder.privateMessageCountUnread,
|
||||
write: (value) => {
|
||||
if (isPosNumeric(value)) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import ko from 'ko';
|
||||
import { koComputable } from 'External/ko';
|
||||
|
||||
import { AbstractModel } from 'Knoin/AbstractModel';
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ export class IdentityModel extends AbstractModel {
|
|||
deleteAccess: false
|
||||
});
|
||||
|
||||
this.canBeDeleted = ko.computed(() => !!this.id());
|
||||
this.canBeDeleted = koComputable(() => !!this.id());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue