Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(network): enable network inspector tab through unstable_enableNetworkPanel #2

Merged

Conversation

byCedric
Copy link

@byCedric byCedric commented Dec 4, 2023

Summary

This adds a stripped-down version of the Network tab through &unstable_enableNetworkPanel=true.

image

Edit: This now only enables the Network panel, without disabling any of the existing functionality.

Network tab without disabled options

image

Disabled options highlighted

Screenshot 2023-12-04 at 16 59 00

Test plan

  • Run devtools from source
  • Force @react-native/dev-middleware to serve local hosted instance
  • Force &unstable_enableNetworkPanel=true query parameter to local hosted instance URL
  • Make a request & open Network tab

Upstreaming plan

  • This commit should be sent as a patch to the upstream devtools-frontend repo. I've reviewed the contribution guide.
  • This commit is React Native-specific and cannot be upstreamed.

@byCedric
Copy link
Author

byCedric commented Dec 4, 2023

We can also clone the network files to something like "react-native-network" or something similar to keep this split with the original network tab.

But, as soon as new Hermes CDP implementation is available, I'd guess we want to re-enable these disabled options.

Copy link

@huntie huntie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conceptually these changes are great, and really appreciate digging into the Network panel to figure out which features we can (and should!) disable.

Can I ask that we split this PR in two?

  1. Re-enable the Network panel, in its entirety, via query string flag (ready to go ✅).
  2. Conditionally disable features in the Network panel.
    • I think we want a different approach here if possible — either creating an rn_network entrypoint with forked functionality, or ideally disabling these features via targeted experiments (Root.Runtime.experiments API). For the latter, either using our REACT_NATIVE_SPECIFIC_UI experiment, or per-feature flags — which will likely be very useful as we incrementally build out the CDP implementation of the Network panel.

@byCedric byCedric force-pushed the feature/enable-network-inspector branch from e3d6b25 to 3d5f69f Compare December 5, 2023 12:35
@byCedric byCedric force-pushed the feature/enable-network-inspector branch from 3d5f69f to 6b80685 Compare December 5, 2023 12:37
@byCedric byCedric changed the title feature(network): enable basic network inspector tab feature(network): enable network inspector tab through unstable_enableNetworkPanel Dec 5, 2023
@byCedric byCedric requested a review from huntie December 5, 2023 12:40
@byCedric
Copy link
Author

byCedric commented Dec 5, 2023

@huntie I just pulled out the commit that disables the network features that are unimplemented/non-functional. This PR only enables the network panel/tab through the query parameter.

Unfortunately, I can't really stack PRs on a fork, so I'll hold off creating a new PR that disables non-functional features until this PR is merged.

What about REACT_NATIVE_SUPPORTED_UI/REACT_NATIVE_UNSUPPORTED_UI? I think it's a bit more descriptive of why certain things are conditionally hidden.

Copy link

@huntie huntie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@huntie huntie merged commit 12a45e0 into facebookexperimental:main Dec 5, 2023
2 checks passed
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Dec 7, 2023
)

Summary:
This enables the network panel/inspector by passing the `unstable_enableNetworkPanel=true` to the React Native JS Inspector. (See facebookexperimental/rn-chrome-devtools-frontend#2)

By setting this inside the `experiments`, we can enable/disable network related CDP handlers within the proxy.

## Changelog:

[GENERAL] [ADDED] - Add `enableNetworkInspector` experiment to enable Network panel and CDP handlers in inspector proxy

Pull Request resolved: #41787

Test Plan: TBD, will provide a repository using an Expo canary / RN 0.73.0-rc release.

Reviewed By: NickGerleman

Differential Revision: D51811892

Pulled By: huntie

fbshipit-source-id: 541d96b6f0735104a4050a24a152e1158871ed1d
huntie pushed a commit to facebook/react-native that referenced this pull request Dec 7, 2023
)

Summary:
This enables the network panel/inspector by passing the `unstable_enableNetworkPanel=true` to the React Native JS Inspector. (See facebookexperimental/rn-chrome-devtools-frontend#2)

By setting this inside the `experiments`, we can enable/disable network related CDP handlers within the proxy.

## Changelog:

[GENERAL] [ADDED] - Add `enableNetworkInspector` experiment to enable Network panel and CDP handlers in inspector proxy

Pull Request resolved: #41787

Test Plan: TBD, will provide a repository using an Expo canary / RN 0.73.0-rc release.

Reviewed By: NickGerleman

Differential Revision: D51811892

Pulled By: huntie

fbshipit-source-id: 541d96b6f0735104a4050a24a152e1158871ed1d
huntie added a commit to huntie/react-native that referenced this pull request Dec 7, 2023
Summary:
Sync `react-native/debugger-frontend`. Includes:

- facebookexperimental/rn-chrome-devtools-frontend#2

Changelog: [Internal]

Differential Revision: D51946121
huntie added a commit to huntie/react-native that referenced this pull request Dec 7, 2023
Summary:

Sync `react-native/debugger-frontend`. Includes:

- facebookexperimental/rn-chrome-devtools-frontend#2

Changelog: [Internal]

Differential Revision: D51946121
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Dec 7, 2023
Summary:
Pull Request resolved: #41840

Sync `react-native/debugger-frontend`. Includes:

- facebookexperimental/rn-chrome-devtools-frontend#2

Changelog: [Internal]

Differential Revision: D51946121

fbshipit-source-id: 8118cb5075aa86d95bbd8e1ba56a73360122aaab
huntie added a commit to facebook/react-native that referenced this pull request Dec 8, 2023
Summary:
Pull Request resolved: #41840

Sync `react-native/debugger-frontend`. Includes:

- facebookexperimental/rn-chrome-devtools-frontend#2

Changelog: [Internal]

Differential Revision: D51946121

fbshipit-source-id: 8118cb5075aa86d95bbd8e1ba56a73360122aaab

# Conflicts:
#	packages/debugger-frontend/BUILD_INFO
@ghost
Copy link

ghost commented Dec 20, 2023

How to enable it ? I upgraded to 0.73.1 but I cannot see network tab

@huntie
Copy link

huntie commented Dec 20, 2023

@ngxhuyhoang This feature is specific to Expo apps, and should come as part of a (near) future Expo SDK release.

@ghost
Copy link

ghost commented Dec 20, 2023

Hope release for react-native cli too

Othinn pushed a commit to Othinn/react-native that referenced this pull request Jan 9, 2024
…ebook#41787)

Summary:
This enables the network panel/inspector by passing the `unstable_enableNetworkPanel=true` to the React Native JS Inspector. (See facebookexperimental/rn-chrome-devtools-frontend#2)

By setting this inside the `experiments`, we can enable/disable network related CDP handlers within the proxy.

## Changelog:

[GENERAL] [ADDED] - Add `enableNetworkInspector` experiment to enable Network panel and CDP handlers in inspector proxy

Pull Request resolved: facebook#41787

Test Plan: TBD, will provide a repository using an Expo canary / RN 0.73.0-rc release.

Reviewed By: NickGerleman

Differential Revision: D51811892

Pulled By: huntie

fbshipit-source-id: 541d96b6f0735104a4050a24a152e1158871ed1d
Othinn pushed a commit to Othinn/react-native that referenced this pull request Jan 9, 2024
Summary:
Pull Request resolved: facebook#41840

Sync `react-native/debugger-frontend`. Includes:

- facebookexperimental/rn-chrome-devtools-frontend#2

Changelog: [Internal]

Differential Revision: D51946121

fbshipit-source-id: 8118cb5075aa86d95bbd8e1ba56a73360122aaab
@Nikit-Singh
Copy link

@huntie are there any plans / timeline for this getting added to the react-native-cli as well?

@huntie
Copy link

huntie commented Jan 31, 2024

@Nikit-Singh We intend to, but we can't give a timeline. We are currently focused on building a rearchitected backend debugging stack, upon which features like Network debugging can be built. This is separate from (and aims to replace, for all React Native users) the current Expo-specific implementation.

react-native-community/discussions-and-proposals#733

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants