Fix theme updating issue

Summary:
Follow up on D29436059 (014e571f74), another place where the old format was leaked.

Fixes https://github.com/facebook/flipper/issues/2842 + some mentions on WP

Changelog: Fixed JavaScript exception on main thread occurring after loading Flipper

Reviewed By: nikoant

Differential Revision: D30928768

fbshipit-source-id: 083731e18230825738466b34368c2b5f730e386c
This commit is contained in:
Michel Weststrate
2021-09-14 03:15:55 -07:00
committed by Facebook GitHub Bot
parent c4538c48d6
commit bae2043e06

View File

@@ -34,6 +34,8 @@ import {promisify} from 'util';
const VERSION: string = (global as any).__VERSION__;
const validThemes = ['light', 'dark', 'system'];
// Adds system PATH folders to process.env.PATH for MacOS production bundles.
fixPath();
@@ -109,7 +111,7 @@ if (argv['disable-gpu'] || process.env.FLIPPER_DISABLE_GPU === '1') {
}
process.env.CONFIG = JSON.stringify(config);
nativeTheme.themeSource = ['light', 'dark', 'system'].includes(config.darkMode)
nativeTheme.themeSource = validThemes.includes(config.darkMode)
? config.darkMode
: 'light';
@@ -291,7 +293,11 @@ ipcMain.on('getLaunchTime', (event) => {
});
ipcMain.on('setTheme', (_e, mode: 'light' | 'dark' | 'system') => {
nativeTheme.themeSource = mode;
if (validThemes.includes(mode)) {
nativeTheme.themeSource = mode;
} else {
console.warn('Received invalid theme: ' + mode);
}
});
ipcMain.on(