Skip to content

Commit

Permalink
Fix reload action (regression in facebook#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
huntie committed Feb 28, 2025
1 parent 3adf51a commit 910686c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions front_end/entrypoints/inspector_main/InspectorMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,25 @@ Common.Runnable.registerEarlyInitializationRunnable(InspectorMainImpl.instance);

export class ReloadActionDelegate implements UI.ActionRegistration.ActionDelegate {
handleAction(_context: UI.Context.Context, actionId: string): boolean {
const isReactNative = Root.Runtime.experiments.isEnabled(
Root.Runtime.ExperimentName.REACT_NATIVE_SPECIFIC_UI,
);

// [RN] Fork reload handling. React Native targets do not initialize
// ResourceTreeModel (Capability.DOM), and there is no hard reload concept.
if (isReactNative) {
switch (actionId) {
case 'inspector-main.reload':
case 'inspector-main.hard-reload':
const mainTarget = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
if (!mainTarget) {
return false;
}
void mainTarget.pageAgent().invoke_reload({ignoreCache: true});
return true;
}
}

switch (actionId) {
case 'inspector-main.reload':
SDK.ResourceTreeModel.ResourceTreeModel.reloadAllPages(false);
Expand Down

0 comments on commit 910686c

Please sign in to comment.