Wait for client to initliaze on startup deep link
Summary: We were incorrectly assuming a client did not support a plugin because it was not fully initialized. This issue was only apparant on start deep links Reviewed By: mweststrate Differential Revision: D40477503 fbshipit-source-id: 5fd9db765f559b8eb80cc3680ee694dfd2cf9a37
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2bde26391d
commit
c6dbfc87a4
@@ -50,6 +50,7 @@ export type RequestMetadata = {
|
||||
|
||||
export interface ClientConnection {
|
||||
send(data: any): void;
|
||||
|
||||
sendExpectResponse(data: any): Promise<ClientResponseType>;
|
||||
}
|
||||
|
||||
@@ -63,7 +64,6 @@ export default abstract class AbstractClient extends EventEmitter {
|
||||
backgroundPlugins: Plugins;
|
||||
connection: ClientConnection | null | undefined;
|
||||
activePlugins: Set<string>;
|
||||
|
||||
device: BaseDevice;
|
||||
logger: Logger;
|
||||
|
||||
@@ -71,6 +71,11 @@ export default abstract class AbstractClient extends EventEmitter {
|
||||
private readonly serverAddOnControls: ServerAddOnControls;
|
||||
private readonly flipperServer: FlipperServer;
|
||||
|
||||
private resolveInitPromise!: (_: unknown) => void;
|
||||
readonly initializationPromise = new Promise((_resolve) => {
|
||||
this.resolveInitPromise = _resolve;
|
||||
});
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
query: ClientQuery,
|
||||
@@ -116,6 +121,7 @@ export default abstract class AbstractClient extends EventEmitter {
|
||||
}
|
||||
});
|
||||
this.emit('plugins-change');
|
||||
this.resolveInitPromise?.(null);
|
||||
}
|
||||
|
||||
// get the supported plugins
|
||||
|
||||
Reference in New Issue
Block a user