From df09e349276c6a1528904237b06cf52e2134a126 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 28 Jan 2023 20:58:04 +1000 Subject: [PATCH] Fix DailyLimits passing undefined values into SpinBox If the type says it's a number, we should ensure it's a number :-) This also fixes fields being empty when they contain a 0 value. --- ts/components/SpinBox.svelte | 2 +- ts/deck-options/DailyLimits.svelte | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ts/components/SpinBox.svelte b/ts/components/SpinBox.svelte index 923067d4f..bc2e9495d 100644 --- a/ts/components/SpinBox.svelte +++ b/ts/components/SpinBox.svelte @@ -23,7 +23,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } let stringValue: string; - $: if (value) stringValue = value.toFixed(decimalPlaces(step)); + $: stringValue = value.toFixed(decimalPlaces(step)); function update(this: HTMLInputElement): void { const newValue = parseFloat(this.value); diff --git a/ts/deck-options/DailyLimits.svelte b/ts/deck-options/DailyLimits.svelte index a7640ba12..1ee36a83c 100644 --- a/ts/deck-options/DailyLimits.svelte +++ b/ts/deck-options/DailyLimits.svelte @@ -126,8 +126,8 @@ : [], ); - let newValue: number; - let reviewsValue: number; + let newValue = 0; + let reviewsValue = 0; const settings = { newLimit: {