From 0bab29e754880473c571044786904fbfefdc12f4 Mon Sep 17 00:00:00 2001 From: Edmond Chui <1967998+EdmondChuiHW@users.noreply.github.com> Date: Thu, 5 Sep 2024 18:24:33 +0100 Subject: [PATCH] Add reload-to-profile for Fusebox --- .../panels/react_devtools/ReactDevToolsModel.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/front_end/panels/react_devtools/ReactDevToolsModel.ts b/front_end/panels/react_devtools/ReactDevToolsModel.ts index 34fa3a062e7f..9099ad1e9d8b 100644 --- a/front_end/panels/react_devtools/ReactDevToolsModel.ts +++ b/front_end/panels/react_devtools/ReactDevToolsModel.ts @@ -163,10 +163,22 @@ export class ReactDevToolsModel extends SDK.SDKModel.SDKModel { #finishInitializationAndNotify(): void { this.#bridge = ReactDevTools.createBridge(this.#wall); - this.#store = ReactDevTools.createStore(this.#bridge); + this.#store = ReactDevTools.createStore(this.#bridge, { + supportsReloadAndProfile: true, + bypassReloadAndProfileCapabilityChecks: true, + }); + this.#attachReloadToProfileListener(); this.dispatchEventToListeners(Events.InitializationCompleted); } + #attachReloadToProfileListener(): void { + this.#wall.listen((message: ReactDevToolsTypes.Message): void => { + if (message.event === 'reloadAppForProfiling') { + SDK.ResourceTreeModel.ResourceTreeModel.reloadAllPages(false); + } + }); + } + #handleBackendExecutionContextUnavailable({data: errorMessage}: ReactDevToolsBindingsBackendExecutionContextUnavailableEvent): void { this.dispatchEventToListeners(Events.InitializationFailed, errorMessage); }