From e1e9ca0f5260f04ca41e72a17e01007f6cca4158 Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Wed, 8 Sep 2021 09:55:25 -0700 Subject: [PATCH] Fix startup error when loading theme Summary: During testing, observed that Flipper always starts with an exception if `darkMode` is `true` or `false` (the old format) during startup, and this exception keeps on happening until the setting is changed. The root cause is that the setting is treated verbatim since D30666966 (https://github.com/facebook/flipper/commit/9a4d94c971d0719efa520f3d82abdb4d23e3b558), trigger a very confusing Electron error. This diff addresses that. Reviewed By: timur-valiev Differential Revision: D30806453 fbshipit-source-id: fc7bbdda4e8bdf2dc4e3ca7ab1b05984c9406c68 --- desktop/static/setup.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/desktop/static/setup.ts b/desktop/static/setup.ts index e41d0cb0b..bd2f90e6a 100644 --- a/desktop/static/setup.ts +++ b/desktop/static/setup.ts @@ -56,6 +56,12 @@ export default function setup(argv: any) { // Non-persistent CLI arguments. config = { ...config, + darkMode: + typeof config.darkMode === 'boolean' + ? config.darkMode // normalise darkmode from old format + ? 'dark' + : 'light' + : config.darkMode, updaterEnabled: argv.updater, launcherEnabled: argv.launcher, launcherMsg: argv.launcherMsg,