mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-04 06:57:03 +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,5 @@
|
|||
import ko from 'ko';
|
||||
import { koComputable } from 'External/ko';
|
||||
|
||||
import { FolderType, FolderSortMode } from 'Common/EnumsUser';
|
||||
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
||||
|
|
@ -100,7 +101,7 @@ export const FolderUserStore = new class {
|
|||
archiveFolder: fSetSystemFolderType(FolderType.Archive)
|
||||
});
|
||||
|
||||
self.quotaPercentage = ko.computed(() => {
|
||||
self.quotaPercentage = koComputable(() => {
|
||||
const quota = self.quotaLimit(), usage = self.quotaUsage();
|
||||
return 0 < quota ? Math.ceil((usage / quota) * 100) : 0;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import ko from 'ko';
|
||||
import { koComputable } from 'External/ko';
|
||||
|
||||
import { Layout, EditorDefaultType } from 'Common/EnumsUser';
|
||||
import { pInt, addObservablesTo } from 'Common/Utils';
|
||||
|
|
@ -39,7 +40,7 @@ export const SettingsUserStore = new class {
|
|||
|
||||
self.init();
|
||||
|
||||
self.usePreviewPane = ko.computed(() => Layout.NoPreview !== self.layout() && !ThemeStore.isMobile());
|
||||
self.usePreviewPane = koComputable(() => Layout.NoPreview !== self.layout() && !ThemeStore.isMobile());
|
||||
|
||||
const toggleLayout = () => {
|
||||
const value = ThemeStore.isMobile() ? Layout.NoPreview : self.layout();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue