diff options
author | Ricardo Cino <ricardo@cino.io> | 2022-11-28 16:53:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-28 15:53:04 +0000 |
commit | d5d685aaf4e796faf612c6d0fea0f0cc9ea49614 (patch) | |
tree | 72f027dc2d57f00c366d61570fd76ed6a0fcb27a /src/features | |
parent | 6.2.1-nightly.52 [skip ci] (diff) | |
download | ferdium-app-d5d685aaf4e796faf612c6d0fea0f0cc9ea49614.tar.gz ferdium-app-d5d685aaf4e796faf612c6d0fea0f0cc9ea49614.tar.zst ferdium-app-d5d685aaf4e796faf612c6d0fea0f0cc9ea49614.zip |
fix: ensure default values are working for the all fields in all settings screens (#750)
Co-authored-by: Vijay A <vraravam@users.noreply.github.com>
Diffstat (limited to 'src/features')
-rw-r--r-- | src/features/todos/store.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/features/todos/store.ts b/src/features/todos/store.ts index 5cf5e1d75..bff099eb1 100644 --- a/src/features/todos/store.ts +++ b/src/features/todos/store.ts | |||
@@ -19,6 +19,7 @@ import Reaction, { createReactions } from '../../stores/lib/Reaction'; | |||
19 | import { createActionBindings } from '../utils/ActionBinding'; | 19 | import { createActionBindings } from '../utils/ActionBinding'; |
20 | import { IPC, TODOS_ROUTES } from './constants'; | 20 | import { IPC, TODOS_ROUTES } from './constants'; |
21 | import UserAgent from '../../models/UserAgent'; | 21 | import UserAgent from '../../models/UserAgent'; |
22 | import { ifUndefined } from '../../jsUtils'; | ||
22 | 23 | ||
23 | const debug = require('../../preload-safe-debug')( | 24 | const debug = require('../../preload-safe-debug')( |
24 | 'Ferdium:feature:todos:store', | 25 | 'Ferdium:feature:todos:store', |
@@ -46,7 +47,7 @@ export default class TodoStore extends FeatureStore { | |||
46 | } | 47 | } |
47 | 48 | ||
48 | @computed get width() { | 49 | @computed get width() { |
49 | const width = this.settings.width || DEFAULT_TODOS_WIDTH; | 50 | const width = ifUndefined<number>(this.settings.width, DEFAULT_TODOS_WIDTH); |
50 | 51 | ||
51 | return width < TODOS_MIN_WIDTH ? TODOS_MIN_WIDTH : width; | 52 | return width < TODOS_MIN_WIDTH ? TODOS_MIN_WIDTH : width; |
52 | } | 53 | } |
@@ -56,10 +57,10 @@ export default class TodoStore extends FeatureStore { | |||
56 | } | 57 | } |
57 | 58 | ||
58 | @computed get isTodosPanelVisible() { | 59 | @computed get isTodosPanelVisible() { |
59 | if (this.settings.isTodosPanelVisible === undefined) { | 60 | return ifUndefined<boolean>( |
60 | return DEFAULT_TODOS_VISIBLE; | 61 | this.settings.isTodosPanelVisible, |
61 | } | 62 | DEFAULT_TODOS_VISIBLE, |
62 | return this.settings.isTodosPanelVisible; | 63 | ); |
63 | } | 64 | } |
64 | 65 | ||
65 | @computed get isFeatureEnabledByUser() { | 66 | @computed get isFeatureEnabledByUser() { |