Skip to content

Commit 97e9912

Browse files
authored
Fix reload action (regression in #144) (#153)
1 parent 3adf51a commit 97e9912

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

front_end/entrypoints/inspector_main/InspectorMain.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,25 @@ Common.Runnable.registerEarlyInitializationRunnable(InspectorMainImpl.instance);
122122

123123
export class ReloadActionDelegate implements UI.ActionRegistration.ActionDelegate {
124124
handleAction(_context: UI.Context.Context, actionId: string): boolean {
125+
const isReactNative = Root.Runtime.experiments.isEnabled(
126+
Root.Runtime.ExperimentName.REACT_NATIVE_SPECIFIC_UI,
127+
);
128+
129+
// [RN] Fork reload handling. React Native targets do not initialize
130+
// ResourceTreeModel (Capability.DOM), and there is no hard reload concept.
131+
if (isReactNative) {
132+
switch (actionId) {
133+
case 'inspector-main.reload':
134+
case 'inspector-main.hard-reload':
135+
const mainTarget = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
136+
if (!mainTarget) {
137+
return false;
138+
}
139+
void mainTarget.pageAgent().invoke_reload({ignoreCache: true});
140+
return true;
141+
}
142+
}
143+
125144
switch (actionId) {
126145
case 'inspector-main.reload':
127146
SDK.ResourceTreeModel.ResourceTreeModel.reloadAllPages(false);

front_end/panels/react_devtools/ReactDevToolsModel.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ export class ReactDevToolsModel extends SDK.SDKModel.SDKModel<EventTypes> {
202202
}
203203

204204
#handleReloadAppForProfiling(): void {
205-
SDK.ResourceTreeModel.ResourceTreeModel.reloadAllPages(false);
205+
const mainTarget = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
206+
void mainTarget?.pageAgent().invoke_reload({ignoreCache: true});
206207
}
207208

208209
#handleBackendExecutionContextUnavailable({data: errorMessage}: ReactDevToolsBindingsBackendExecutionContextUnavailableEvent): void {

0 commit comments

Comments
 (0)