From b610a4a1f5093e04b71b8dd61b64f31bc6a4d300 Mon Sep 17 00:00:00 2001 From: Anton Kastritskiy Date: Fri, 13 Sep 2024 07:35:24 -0700 Subject: [PATCH] ignore failed to update plugins because of server disconnect Summary: To silence oocasional un actionable tasks With such [logview](https://www.internalfb.com/logview/flipper_javascript/4e49a576ccc0f767c96cfbdbdc7d1123?trace_key=41bdca6a219d4800f091a662b5ce1405&trace_tab=shared&ds=%7B%22start%22%3A%22-1%20day%22%2C%22end%22%3A%22now%22%7D) Reviewed By: mweststrate Differential Revision: D62638786 fbshipit-source-id: ee8c1ff5a390061a9def4b7dfe7faf4ba0185760 --- .../flipper-ui/src/dispatcher/pluginManager.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/desktop/flipper-ui/src/dispatcher/pluginManager.tsx b/desktop/flipper-ui/src/dispatcher/pluginManager.tsx index b0bd82f6404..fc6bbcc6ca2 100644 --- a/desktop/flipper-ui/src/dispatcher/pluginManager.tsx +++ b/desktop/flipper-ui/src/dispatcher/pluginManager.tsx @@ -66,13 +66,15 @@ export default ( }, ) => { // This needn't happen immediately and is (light) I/O work. - if (window.requestIdleCallback) { - window.requestIdleCallback(() => { - refreshInstalledPlugins(store).catch((err) => - console.error('Failed to refresh installed plugins:', err), - ); + window.requestIdleCallback?.(() => { + refreshInstalledPlugins(store).catch((err: Error) => { + if (err.toString().includes('Not connected to Flipper server')) { + console.warn('Failed to refresh installed plugins:', err); + } else { + console.error('Failed to refresh installed plugins:', err); + } }); - } + }); let running = false; const unsubscribeHandlePluginCommands = sideEffect(