Fix settings not being saved before restart

Summary:
2022 New years intention: don't fix problems with arbitrarily timeouts

In production builds, settings weren't saved if apply + restart was used (apply and manual restart did work). I suspect a bug in redux-persist, since we do await a flush, but anyway a little delay seems to fix it consistently.

Changelog: Fixed an issue where changing settings wasn't persisted when using "Apply + Restart

P.S. I won't accept any insinuations that this was my new years intention of 2015, 2017, 2018, 2020 and 2021 as well.

Reviewed By: cekkaewnumchai

Differential Revision: D33377718

fbshipit-source-id: 3a9ec58b4f8208603d786342ddaf6bf02b3887c7
This commit is contained in:
Michel Weststrate
2022-01-04 04:16:40 -08:00
committed by Facebook GitHub Bot
parent 582ea64011
commit 9267a19c89

View File

@@ -27,6 +27,7 @@ import {
Platform,
reportUsage,
Settings,
sleep,
} from 'flipper-common';
import {Modal, message, Button} from 'antd';
import {Layout, withTrackingScope, _NuxManagerContext} from 'flipper-plugin';
@@ -73,9 +74,9 @@ class SettingsSheet extends Component<Props, State> {
this.props.updateSettings(this.state.updatedSettings);
this.props.updateLauncherSettings(this.state.updatedLauncherSettings);
this.props.onHide();
return flush().then(() => {
getRenderHostInstance().restartFlipper(true);
});
await flush();
await sleep(1000);
getRenderHostInstance().restartFlipper(true);
};
applyChangesWithoutRestart = async () => {