Skip to content

Commit 5e74dc7

Browse files
hoxyqfacebook-github-bot
authored andcommitted
Use panel query param instead of landingView (#53468)
Summary: Pull Request resolved: #53468 # Changelog: [Internal] I've just discovered today that Chrome DevTools has a native support for `panel` query parameter, we don't need a custom one. Reviewed By: alanleedev Differential Revision: D81052828 fbshipit-source-id: 6f8ef5b576dbff70cabd6ab792bc0f6e615928e7
1 parent c120587 commit 5e74dc7

6 files changed

Lines changed: 37 additions & 21 deletions

File tree

packages/dev-middleware/src/middleware/openDebuggerMiddleware.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export default function openDebuggerMiddleware({
6767
launchId?: string,
6868
telemetryInfo?: string,
6969
target?: string,
70-
landingView?: string,
70+
panel?: string,
7171
...
7272
} = parsedUrl.query;
7373

@@ -152,7 +152,7 @@ export default function openDebuggerMiddleware({
152152
telemetryInfo: query.telemetryInfo,
153153
appId: target.appId,
154154
useFuseboxEntryPoint,
155-
landingView: query.landingView,
155+
panel: query.panel,
156156
},
157157
);
158158
if (

packages/dev-middleware/src/utils/getDevToolsFrontendUrl.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default function getDevToolsFrontendUrl(
2424
/** Whether to use the modern `rn_fusebox.html` entry point. */
2525
useFuseboxEntryPoint?: boolean,
2626
appId?: string,
27-
landingView?: string,
27+
panel?: string,
2828
}>,
2929
): string {
3030
const wsParam = getWsParam({
@@ -55,8 +55,8 @@ export default function getDevToolsFrontendUrl(
5555
if (options?.telemetryInfo != null && options.telemetryInfo !== '') {
5656
searchParams.append('telemetryInfo', options.telemetryInfo);
5757
}
58-
if (options?.landingView != null && options.landingView !== '') {
59-
searchParams.append('landingView', options.landingView);
58+
if (options?.panel != null && options.panel !== '') {
59+
searchParams.append('panel', options.panel);
6060
}
6161

6262
return appUrl + '?' + searchParams.toString();

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,14 +1887,6 @@ public final class com/facebook/react/devsupport/BundleDownloader$BundleInfo$Com
18871887
public final class com/facebook/react/devsupport/BundleDownloader$Companion {
18881888
}
18891889

1890-
public final class com/facebook/react/devsupport/ChromeDevToolsViewKeys : java/lang/Enum {
1891-
public static final field Performance Lcom/facebook/react/devsupport/ChromeDevToolsViewKeys;
1892-
public static fun getEntries ()Lkotlin/enums/EnumEntries;
1893-
public final fun getValue ()Ljava/lang/String;
1894-
public static fun valueOf (Ljava/lang/String;)Lcom/facebook/react/devsupport/ChromeDevToolsViewKeys;
1895-
public static fun values ()[Lcom/facebook/react/devsupport/ChromeDevToolsViewKeys;
1896-
}
1897-
18981890
public final class com/facebook/react/devsupport/DefaultDevLoadingViewImplementation : com/facebook/react/devsupport/interfaces/DevLoadingViewManager {
18991891
public static final field Companion Lcom/facebook/react/devsupport/DefaultDevLoadingViewImplementation$Companion;
19001892
public fun <init> (Lcom/facebook/react/devsupport/ReactInstanceDevHelper;)V
@@ -1922,7 +1914,7 @@ public class com/facebook/react/devsupport/DevServerHelper {
19221914
public fun getSourceUrl (Ljava/lang/String;)Ljava/lang/String;
19231915
public final fun getWebsocketProxyURL ()Ljava/lang/String;
19241916
public fun isPackagerRunning (Lcom/facebook/react/devsupport/interfaces/PackagerStatusCallback;)V
1925-
public final fun openDebugger (Lcom/facebook/react/bridge/ReactContext;Ljava/lang/String;Ljava/lang/String;)V
1917+
public final fun openDebugger (Lcom/facebook/react/bridge/ReactContext;Ljava/lang/String;Lcom/facebook/react/devsupport/interfaces/DebuggerFrontendPanelName;)V
19261918
public final fun openInspectorConnection ()V
19271919
public final fun openPackagerConnection (Ljava/lang/String;Lcom/facebook/react/devsupport/DevServerHelper$PackagerCommandListener;)V
19281920
}
@@ -2118,6 +2110,15 @@ public abstract interface class com/facebook/react/devsupport/interfaces/BundleL
21182110
public abstract fun onSuccess ()V
21192111
}
21202112

2113+
public final class com/facebook/react/devsupport/interfaces/DebuggerFrontendPanelName : java/lang/Enum {
2114+
public static final field PERFORMANCE Lcom/facebook/react/devsupport/interfaces/DebuggerFrontendPanelName;
2115+
public static fun getEntries ()Lkotlin/enums/EnumEntries;
2116+
public final fun getInternalName ()Ljava/lang/String;
2117+
public fun toString ()Ljava/lang/String;
2118+
public static fun valueOf (Ljava/lang/String;)Lcom/facebook/react/devsupport/interfaces/DebuggerFrontendPanelName;
2119+
public static fun values ()[Lcom/facebook/react/devsupport/interfaces/DebuggerFrontendPanelName;
2120+
}
2121+
21212122
public abstract interface class com/facebook/react/devsupport/interfaces/DevBundleDownloadListener {
21222123
public abstract fun onFailure (Ljava/lang/Exception;)V
21232124
public abstract fun onProgress (Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;)V

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import com.facebook.react.bridge.ReactContext
2121
import com.facebook.react.common.ReactConstants
2222
import com.facebook.react.devsupport.InspectorFlags.getFuseboxEnabled
2323
import com.facebook.react.devsupport.InspectorFlags.getIsProfilingBuild
24+
import com.facebook.react.devsupport.interfaces.DebuggerFrontendPanelName
2425
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener
2526
import com.facebook.react.devsupport.interfaces.PackagerStatusCallback
2627
import com.facebook.react.modules.debug.interfaces.DeveloperSettings
@@ -352,7 +353,11 @@ public open class DevServerHelper(
352353
}
353354

354355
/** Attempt to open the JS debugger on the host machine (on-device CDP debugging). */
355-
public fun openDebugger(context: ReactContext?, errorMessage: String?, landingView: String?) {
356+
public fun openDebugger(
357+
context: ReactContext?,
358+
errorMessage: String?,
359+
panel: DebuggerFrontendPanelName?,
360+
) {
356361
// TODO(huntie): Requests to dev server should not assume 'http' URL scheme
357362
val requestUrlBuilder = StringBuilder()
358363

@@ -365,8 +370,8 @@ public open class DevServerHelper(
365370
)
366371
)
367372

368-
if (landingView != null) {
369-
requestUrlBuilder.append("&landingView=" + Uri.encode(landingView))
373+
if (panel != null) {
374+
requestUrlBuilder.append("&panel=" + Uri.encode(panel.toString()))
370375
}
371376

372377
val request =

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ import java.net.MalformedURLException
7575
import java.net.URL
7676
import java.util.Locale
7777

78-
public enum class ChromeDevToolsViewKeys(public val value: String) {
79-
Performance("timeline")
80-
}
81-
8278
public abstract class DevSupportManagerBase(
8379
protected val applicationContext: Context,
8480
public val reactInstanceDevHelper: ReactInstanceDevHelper,
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
package com.facebook.react.devsupport.interfaces
9+
10+
public enum class DebuggerFrontendPanelName(public val internalName: String) {
11+
PERFORMANCE("timeline");
12+
13+
override fun toString(): String = internalName
14+
}

0 commit comments

Comments
 (0)