Try to invoke Myles while the layout plugin is launching

Summary:
The first launch of Myles might produce a lag connected with the fact that Myles daemon needs to start (mainly, set up a Watchman subscription and depending on what state Watchman is in, it could take ~10 secs to initialise).
Therefore, trying to invoke Myles as soon as the Layout Plugin is enabled.

Reviewed By: mweststrate

Differential Revision: D23371702

fbshipit-source-id: 59ee3fb20b2df1330ff4048462f342ce2e12210a
This commit is contained in:
Dominik Wielgórski
2020-08-28 06:17:21 -07:00
committed by Facebook GitHub Bot
parent d2ceb1238c
commit 610d06cbec

View File

@@ -200,6 +200,8 @@ export default class LayoutPlugin extends FlipperPlugin<
screenDimensions: null, screenDimensions: null,
}; };
private static isMylesInvoked = false;
init() { init() {
if (!this.props.persistedState) { if (!this.props.persistedState) {
// If the selected plugin from the previous session was layout, then while importing the flipper export, the redux store doesn't get updated in the first render, due to which the plugin crashes, as it has no persisted state // If the selected plugin from the previous session was layout, then while importing the flipper export, the redux store doesn't get updated in the first render, due to which the plugin crashes, as it has no persisted state
@@ -222,6 +224,13 @@ export default class LayoutPlugin extends FlipperPlugin<
this.openInIDE(params); this.openInIDE(params);
}); });
// since the first launch of Myles might produce a lag (Myles daemon needs to start)
// try to invoke Myles during the first launch of the Layout Plugin
if (!LayoutPlugin.isMylesInvoked) {
this.invokeMyles();
LayoutPlugin.isMylesInvoked = true;
}
if (this.props.isArchivedDevice) { if (this.props.isArchivedDevice) {
this.getDevice() this.getDevice()
.then((d) => { .then((d) => {
@@ -265,6 +274,10 @@ export default class LayoutPlugin extends FlipperPlugin<
); );
}; };
invokeMyles = async () => {
await IDEFileResolver.resolveFullPathsFromMyles('.config', 'fbsource');
};
onToggleTargetMode = () => { onToggleTargetMode = () => {
const inTargetMode = !this.state.inTargetMode; const inTargetMode = !this.state.inTargetMode;
this.setState({inTargetMode}); this.setState({inTargetMode});