From d5d685aaf4e796faf612c6d0fea0f0cc9ea49614 Mon Sep 17 00:00:00 2001 From: Ricardo Cino Date: Mon, 28 Nov 2022 16:53:04 +0100 Subject: fix: ensure default values are working for the all fields in all settings screens (#750) Co-authored-by: Vijay A --- src/features/todos/store.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/features/todos/store.ts') 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'; import { createActionBindings } from '../utils/ActionBinding'; import { IPC, TODOS_ROUTES } from './constants'; import UserAgent from '../../models/UserAgent'; +import { ifUndefined } from '../../jsUtils'; const debug = require('../../preload-safe-debug')( 'Ferdium:feature:todos:store', @@ -46,7 +47,7 @@ export default class TodoStore extends FeatureStore { } @computed get width() { - const width = this.settings.width || DEFAULT_TODOS_WIDTH; + const width = ifUndefined(this.settings.width, DEFAULT_TODOS_WIDTH); return width < TODOS_MIN_WIDTH ? TODOS_MIN_WIDTH : width; } @@ -56,10 +57,10 @@ export default class TodoStore extends FeatureStore { } @computed get isTodosPanelVisible() { - if (this.settings.isTodosPanelVisible === undefined) { - return DEFAULT_TODOS_VISIBLE; - } - return this.settings.isTodosPanelVisible; + return ifUndefined( + this.settings.isTodosPanelVisible, + DEFAULT_TODOS_VISIBLE, + ); } @computed get isFeatureEnabledByUser() { -- cgit v1.2.3-54-g00ecf