From d720b2087015a5d9e2d568c1310d8b02916c800d Mon Sep 17 00:00:00 2001 From: Pritesh Nandgaonkar Date: Thu, 7 Mar 2019 14:34:45 -0800 Subject: [PATCH] Solved the bug, where it didn't used to connect to Flipper Summary: The graphql plugin gets injected after the client is connected. In this case, earlier we didn't use to call `didconnect` assuming that it will be called when the plugin gets clicked by the user in the UI. But that is not true anymore as GraphQL plugin is a background plugin, And we don't call `didConnect` for the background plugins on the user click in the UI, as we assume that background plugins should have already received the call before. This diff fixes the issue by calling didConnect on the background plugin which gets added after the `FlipperClient` is initialised. {F152780726} Look at the bug: Reviewed By: danielbuechele Differential Revision: D14369587 fbshipit-source-id: f75bf4e4463a31fa4735e90245c46632858a32b7 --- xplat/Flipper/FlipperClient.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xplat/Flipper/FlipperClient.cpp b/xplat/Flipper/FlipperClient.cpp index fbead0e68..454ca565a 100644 --- a/xplat/Flipper/FlipperClient.cpp +++ b/xplat/Flipper/FlipperClient.cpp @@ -68,6 +68,12 @@ void FlipperClient::addPlugin(std::shared_ptr plugin) { step->complete(); if (connected_) { refreshPlugins(); + if (plugin->runInBackground()) { + auto& conn = connections_[plugin->identifier()]; + conn = std::make_shared( + socket_.get(), plugin->identifier()); + plugin->didConnect(conn); + } } }); }