Skip to content

Commit 545b1d5

Browse files
committed
Add reload-to-profile for Fusebox
1 parent 2c40d48 commit 545b1d5

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

front_end/panels/react_devtools/ReactDevToolsModel.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,21 @@ export class ReactDevToolsModel extends SDK.SDKModel.SDKModel<EventTypes> {
163163

164164
#finishInitializationAndNotify(): void {
165165
this.#bridge = ReactDevTools.createBridge(this.#wall);
166-
this.#store = ReactDevTools.createStore(this.#bridge);
166+
this.#store = ReactDevTools.createStore(this.#bridge, {
167+
supportsReloadAndProfile: true,
168+
});
169+
this.#attachReloadToProfileListener();
167170
this.dispatchEventToListeners(Events.InitializationCompleted);
168171
}
169172

173+
#attachReloadToProfileListener(): void {
174+
this.#wall.listen((message: ReactDevToolsTypes.Message): void => {
175+
if (message.event === 'reloadAppForProfiling') {
176+
SDK.ResourceTreeModel.ResourceTreeModel.reloadAllPages(false);
177+
}
178+
});
179+
}
180+
170181
#handleBackendExecutionContextUnavailable({data: errorMessage}: ReactDevToolsBindingsBackendExecutionContextUnavailableEvent): void {
171182
this.dispatchEventToListeners(Events.InitializationFailed, errorMessage);
172183
}

front_end/third_party/react-devtools/package/frontend.d.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ export type Bridge = {
1919
};
2020
export type Store = Object;
2121
export type BrowserTheme = 'dark' | 'light';
22+
export type Config = {
23+
supportsReloadAndProfile?: boolean,
24+
};
2225

2326
export function createBridge(wall: Wall): Bridge;
24-
export function createStore(bridge: Bridge): Store;
27+
export function createStore(bridge: Bridge, config?: Config): Store;
2528

2629
export type Source = {
2730
sourceURL: string,

0 commit comments

Comments
 (0)