-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
DevTools: Add version to protocol used between backend/frontend #21326
Comments
Here is my proposal:
Put another way, there are three cases we'll need to handle:
|
I think ideally for Flipper and RN, React DevTools frontend would just support all backwards version of the backend protocol (kind of like it supports all recent React versions) but I don't think this is feasible for me to maintain. (Also the ship has already sailed with past releases that did not specify a protocol version.) Even if that was not the case, I think frontend updates to things like inspecting element props and state (which use new React Suspense APIs) would just be too complicated to manage if I had to support multiple protocol versions. In terms of managing that kind of complexity going forward, one theoretical option would be to somehow bundle multiple versions of the frontend into each NPM release and then dynamically load them based on the backend version, but I think this would also be a big lift and maybe isn't the most pragmatic solution. |
Summary: Bumps [react-devtools-core](https://github.com/facebook/react/tree/master/packages/react-devtools-core) from 4.10.1 to 4.10.2. This update has only one change: facebook/react#21344 For more background information on this upgrade: facebook/react#21326 cc mweststrate Pull Request resolved: #2243 Reviewed By: bvaughn Differential Revision: D28040682 Pulled By: mweststrate fbshipit-source-id: 82b1212f839719ff69b3b7735a8a24042b382085
I think this is done! The protocol check will release in 4.13 (soon). |
The problem
DevTools packages are published to NPM and follow semver for their public APIs (e.g.
connectToDevTools
fromreact-devtools-core
). However the protocol used to communicate between the "backend" and "frontend" components is unversioned and may change between releases. Normally this does not cause a problem as the browser extensions,react-devtools-inline
package, andreact-devtools
standalone package (used for browsers like Safari) all bundle these components together (e.g. the frontend injects or serves via an embedded web server the backend script so there's a 1:1 match).However, React Native poses a special challenge. The React Native renderer embeds the "backend" component within renderer itself (in DEV mode), but the user launches the "frontend" UI via NPM or a tool like Flipper or the React Native Debugger. In either case, there is no guarantee that the version of the "frontend" UI will match the version of the embedded "backend". (React Native does specify a
react-devtools-core
dependency but users are often running a globally installed version of the React DevTools or Flipper and so nothing even checks the dependency version.)This means that updates to React Native (or more specifically, updates to the embedded DevTools backend) can cause DevTools installations to stop working without an apparent reason or an obvious solution.
The plan
The long term plan going forward (as implemented in #21331) is:
The short term plan (as implemented in #21344) is:
Based on my not-very-scientific poll it seems like people mostly use DevTools via NPM, but Flipper and React Native Debugger have a pretty big user share too. The upgrade/downgrade instructions will then be geared primarily to NPM users but with an FBURL that links to a Gist with instructions for these other tools as well.
Checklist
The text was updated successfully, but these errors were encountered: