From 0beb10c594a2847ec696e3b7f6e26a01a849c799 Mon Sep 17 00:00:00 2001 From: Moti Zilberman Date: Wed, 20 Mar 2024 16:13:14 +0000 Subject: [PATCH] Early init FuseboxClientMetadataModel (#25) --- front_end/entrypoints/rn_inspector/rn_inspector.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/front_end/entrypoints/rn_inspector/rn_inspector.ts b/front_end/entrypoints/rn_inspector/rn_inspector.ts index 13af5b1626e..54d2a596854 100644 --- a/front_end/entrypoints/rn_inspector/rn_inspector.ts +++ b/front_end/entrypoints/rn_inspector/rn_inspector.ts @@ -62,7 +62,17 @@ class FuseboxClientMetadataModel extends SDK.SDKModel.SDKModel { SDK.SDKModel.SDKModel.register( FuseboxClientMetadataModel, - {capabilities: SDK.Target.Capability.None, autostart: true}, + { + capabilities: SDK.Target.Capability.None, + autostart: true, + // Ensure FuseboxClient.setClientMetadata is sent before most other CDP domains + // are initialised. This allows the backend to confidently detect non-Fusebox + // clients by the fact that they send e.g. Runtime.enable without sending any + // Fusebox-specific messages first. + // TODO: Explicitly depend on this model in RuntimeModel and LogModel, and + // remove the `early` and `autostart` flags. + early: true, + }, ); // @ts-ignore Exposed for legacy layout tests