diff --git a/desktop/app/src/chrome/SettingsSheet.tsx b/desktop/app/src/chrome/SettingsSheet.tsx index af083cb0b..d6f93de00 100644 --- a/desktop/app/src/chrome/SettingsSheet.tsx +++ b/desktop/app/src/chrome/SettingsSheet.tsx @@ -22,7 +22,7 @@ import {flush} from '../utils/persistor'; import ToggledSection from './settings/ToggledSection'; import {FilePathConfigField, ConfigText} from './settings/configFields'; import KeyboardShortcutInput from './settings/KeyboardShortcutInput'; -import {isEqual} from 'lodash'; +import {isEqual, isMatch, isEmpty} from 'lodash'; import restartFlipper from '../utils/restartFlipper'; import LauncherSettingsPanel from '../fb-stubs/LauncherSettingsPanel'; import SandySettingsPanel from '../fb-stubs/SandySettingsPanel'; @@ -64,6 +64,8 @@ type DispatchFromProps = { type State = { updatedSettings: Settings; updatedLauncherSettings: LauncherSettings; + forcedRestartSettings: Partial; + forcedRestartLauncherSettings: Partial; }; type Props = OwnProps & StateFromProps & DispatchFromProps; @@ -71,6 +73,8 @@ class SettingsSheet extends Component { state: State = { updatedSettings: {...this.props.settings}, updatedLauncherSettings: {...this.props.launcherSettings}, + forcedRestartSettings: {}, + forcedRestartLauncherSettings: {}, }; componentDidMount() { @@ -147,6 +151,15 @@ class SettingsSheet extends Component { isEqual(this.props.settings, this.state.updatedSettings) && isEqual(this.props.launcherSettings, this.state.updatedLauncherSettings); + const forcedRestart = + (!isEmpty(this.state.forcedRestartSettings) && + !isMatch(this.props.settings, this.state.forcedRestartSettings)) || + (!isEmpty(this.state.forcedRestartLauncherSettings) && + !isMatch( + this.props.launcherSettings, + this.state.forcedRestartLauncherSettings, + )); + const contents = ( { ...this.state.updatedLauncherSettings, releaseChannel: v, }, + forcedRestartLauncherSettings: { + ...this.state.forcedRestartLauncherSettings, + releaseChannel: v, + }, }); }} /> @@ -256,6 +273,10 @@ class SettingsSheet extends Component { ...this.state.updatedSettings, disableSandy: v, }, + forcedRestartSettings: { + ...this.state.forcedRestartSettings, + disableSandy: v, + }, }); }} /> @@ -346,7 +367,7 @@ class SettingsSheet extends Component { Cancel