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
This commit is contained in:
Pritesh Nandgaonkar
2019-03-07 14:34:45 -08:00
committed by Facebook Github Bot
parent 2c05fdf347
commit d720b20870

View File

@@ -68,6 +68,12 @@ void FlipperClient::addPlugin(std::shared_ptr<FlipperPlugin> plugin) {
step->complete(); step->complete();
if (connected_) { if (connected_) {
refreshPlugins(); refreshPlugins();
if (plugin->runInBackground()) {
auto& conn = connections_[plugin->identifier()];
conn = std::make_shared<FlipperConnectionImpl>(
socket_.get(), plugin->identifier());
plugin->didConnect(conn);
}
} }
}); });
} }