From 610d06cbec772903193e880927407c07238f2ec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Wielg=C3=B3rski?= Date: Fri, 28 Aug 2020 06:17:21 -0700 Subject: [PATCH] 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 --- desktop/plugins/layout/index.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/desktop/plugins/layout/index.tsx b/desktop/plugins/layout/index.tsx index 1fc3cd74a..bfe7a16f1 100644 --- a/desktop/plugins/layout/index.tsx +++ b/desktop/plugins/layout/index.tsx @@ -200,6 +200,8 @@ export default class LayoutPlugin extends FlipperPlugin< screenDimensions: null, }; + private static isMylesInvoked = false; + init() { 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 @@ -222,6 +224,13 @@ export default class LayoutPlugin extends FlipperPlugin< 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) { this.getDevice() .then((d) => { @@ -265,6 +274,10 @@ export default class LayoutPlugin extends FlipperPlugin< ); }; + invokeMyles = async () => { + await IDEFileResolver.resolveFullPathsFromMyles('.config', 'fbsource'); + }; + onToggleTargetMode = () => { const inTargetMode = !this.state.inTargetMode; this.setState({inTargetMode});