From dc57aa186373ca91abd90fb2e8e52497cfd8b7b1 Mon Sep 17 00:00:00 2001 From: automated-signal <37887102+automated-signal@users.noreply.github.com> Date: Wed, 25 May 2022 15:32:50 -0700 Subject: [PATCH] Make that theme values are in the expected range Co-authored-by: Scott Nonnenberg --- app/main.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/main.ts b/app/main.ts index 52ca71a5e..591e605d4 100644 --- a/app/main.ts +++ b/app/main.ts @@ -253,8 +253,12 @@ async function getThemeSetting({ const json = await sql.sqlCall('getItemById', ['theme-setting']); - // Default to `system` if setting doesn't exist yet - const slowValue = json ? json.value : 'system'; + // Default to `system` if setting doesn't exist or is invalid + const setting: unknown = json?.value; + const slowValue = + setting === 'light' || setting === 'dark' || setting === 'system' + ? setting + : 'system'; ephemeralConfig.set('theme-setting', slowValue);