Commit Graph
42 Commits
Author SHA1 Message Date
Brian VaughnandGitHub 0452c25091 DevTools imports (#24163)
* Update DevTools imports: react-dom -> react-dom/client
* Silence ReactDOM.render warning in DevTools test shell
2022-03-25 12:02:39 -04:00
Brian VaughnandGitHub 13b1c6d178 Disable unsupported Bridge protocol version dialog and add workaround for old protocol operations format (#24093)
Rationale: The only case where the unsupported dialog really matters is React Naive. That's the case where the frontend and backend versions are most likely to mismatch. In React Native, the backend is likely to send the bridge protocol version before sending operations– since the agent does this proactively during initialization.

I've tested the React Native starter app– after forcefully downgrading the backend version to 4.19.1 (see #23307 (comment)) and verified that this change "fixes" things. Not only does DevTools no longer throw an error that causes the UI to be hidden– it works (meaning that the Components tree can be inspected and interacted with).
2022-03-15 13:48:26 -04:00
abd56036d5 Move createRoot/hydrateRoot to react-dom/client (#23385)
* Move createRoot/hydrateRoot to /client

We want these APIs ideally to be imported separately from things you
might use in arbitrary components (like flushSync). Those other methods
are "isomorphic" to how the ReactDOM tree is rendered. Similar to hooks.

E.g. importing flushSync into a component that only uses it on the client
should ideally not also pull in the entry client implementation on the
server.

This also creates a nicer parity with /server where the roots are in a
separate entry point.

Unfortunately, I can't quite do this yet because we have some legacy APIs
that we plan on removing (like findDOMNode) and we also haven't implemented
flushSync using a flag like startTransition does yet.

Another problem is that we currently encourage these APIs to be aliased by
/profiling (or unstable_testing). In the future you don't have to alias
them because you can just change your roots to just import those APIs and
they'll still work with the isomorphic forms. Although we might also just
use export conditions for them.

For that all to work, I went with a different strategy for now where the
real API is in / but it comes with a warning if you use it. If you instead
import /client it disables the warning in a wrapper. That means that if you
alias / then import /client that will inturn import the alias and it'll
just work.

In a future breaking changes (likely when we switch to ESM) we can just
remove createRoot/hydrateRoot from / and move away from the aliasing
strategy.

* Update tests to import from react-dom/client

* Fix fixtures

* Update warnings

* Add test for the warning

* Update devtools

* Change order of react-dom, react-dom/client alias

I think the order matters here. The first one takes precedence.

* Require react-dom through client so it can be aliased

Co-authored-by: Andrew Clark <[email protected]>
2022-03-01 00:13:28 -05:00
jstejadaandGitHub 31bdd6d62f [DevTools] Emit new event when DevTools connects in standalone app (#22848) 2021-12-06 08:49:15 -05:00
Gabriel TrompizandGitHub 101be40f95 Reattachment of the splash page event listeners (#22558) (#22560) 2021-10-15 09:16:43 -04:00
Gabriel TrompizandGitHub 18ec2f8890 Allow to use the Profiler when no client is connected in standalone DevTools (#22551) 2021-10-14 08:31:45 -04:00
JuanandGitHub c817fb8ea4 [DevTools] Register logger for standalone DevTools (#22524) 2021-10-08 08:38:11 -04:00
JuanandGitHub 2cea2a653d [DevTools] Enable hook names in standalone app (#22320) 2021-09-17 10:21:54 -04:00
Luna RuanandGitHub 87a1f82ef2 Console Logging for StrictMode Double Rendering (#22030)
React currently suppress console logs in StrictMode during double rendering. However, this causes a lot of confusion. This PR moves the console suppression logic from React into React Devtools. Now by default, we no longer suppress console logs. Instead, we gray out the logs in console during double render. We also add a setting in React Devtools to allow developers to hide console logs during double render if they choose.
2021-08-25 15:35:38 -07:00
Brian VaughnandGitHub b86ad519ba Update entry point exports (#21488)
The following APIs have been added to the `react` stable entry point:
* `SuspenseList`
* `startTransition`
* `unstable_createMutableSource`
* `unstable_useMutableSource`
* `useDeferredValue`
* `useTransition`

The following APIs have been added or removed from the `react-dom` stable entry point:
* `createRoot`
* `unstable_createPortal` (removed)

The following APIs have been added to the `react-is` stable entry point:
* `SuspenseList`
* `isSuspenseList`

The following feature flags have been changed from experimental to true:
* `enableLazyElements`
* `enableSelectiveHydration`
* `enableSuspenseServerRenderer`
2021-05-12 11:28:14 -04:00
Brian VaughnandGitHub 5f6c7586ed DevTools: Add Bridge protocol version backend/frontend (#21331)
Add an explicit Bridge protocol version to the frontend and backend components as well as a check during initialization to ensure that both are compatible. If not, the frontend will display either upgrade or downgrade instructions.

Note that only the `react-devtools-core` (React Native) and `react-devtools-inline` (Code Sandbox) packages implement this check. Browser extensions inject their own backend and so the check is unnecessary. (Arguably the `react-devtools-inline` check is also unlikely to be necessary _but_ has been added as an extra guard for use cases such as Replay.io.)
2021-04-27 17:26:07 -04:00
91e2ddbda9 Expose DEV-mode warnings in devtools UI (#20463)
Co-authored-by: Brian Vaughn <[email protected]>
2020-12-22 11:09:29 -05:00
Brian VaughnandGitHub 234d7d2147 Make DevTools Websocket retry delay configurable (#20107) 2020-10-28 22:08:47 -04:00
09936459e9 Add SSL support to React devtools standalone (#19191)
Co-authored-by: Brian Vaughn <[email protected]>
2020-07-06 10:09:41 -04:00
Brian VaughnandGitHub 9b33a52ace DevTools: Add break-on-warn feature (#19048)
This commit adds a new tab to the Settings modal: Debugging

This new tab has the append component stacks feature and a new one: break on warn

This new feature adds a debugger statement into the console override
2020-05-29 14:34:43 -07:00
Brian VaughnandGitHub dbe7c18b21 Updated DevTools unstable_ API references (#18847) 2020-05-06 11:14:30 -07:00
Sebastian MarkbågeandGitHub b4dbce0e7f Enable prefer-const lint rules (#18451)
* Enable prefer-const rule

Stylistically I don't like this but Closure Compiler takes advantage of
this information.

* Auto-fix lints

* Manually fix the remaining callsites
2020-04-01 12:35:52 -07:00
Mark HuangandGitHub 1addaf599e Fix Cannot read property 'sub' of undefined when navigating to plain-text pages (#17848)
Update various parts of DevTools to account for the fact that the global "hook" might be undefined if DevTools didn't inject it (due to the page's `contentType`) it (due to the page's `contentType`)
2020-02-02 12:04:48 -08:00
Dan AbramovandGitHub fe1bbbae20 Update Flow to 0.84 (#17805)
* Update Flow to 0.84

* Fix violations

* Use inexact object syntax in files from fbsource

* Fix warning extraction to use a modern parser

* Codemod inexact objects to new syntax

* Tighten types that can be exact

* Revert unintentional formatting changes from codemod
2020-01-09 14:50:44 +00:00
Dan AbramovandGitHub 6e9c0d3038 Bump Prettier (#17811)
* Bump Prettier

* Reformat

* Use non-deprecated option
2020-01-09 13:54:11 +00:00
Brian VaughnandGitHub eb80f11d56 DevTools standalone shell changes: (#17213)
* DevTools standalone shell changes:

1. Update React Native connection wording
2. Tweak styles slightly

* Tweaked standalone DevTools error warning text
2019-10-31 09:22:08 -07:00
Sebastian MarkbågeandGitHub d3710442de Remove unstable_ prefix in various internal uses (#17146)
* Rename unstable_createRoot in DevTools

* Rename createSyncRoot in warning
2019-10-18 17:18:10 -07:00
Brian VaughnandGitHub f4b1b9616a Added trace updates feature (DOM only) (#16989)
* Added trace updates feature (DOM only)
* Updated DevTools CHANGELOG
2019-10-03 11:07:18 -07:00
Dan AbramovandBrian Vaughn cff975b2c9 [DevTools] Remove Welcome dialog (#16834) 2019-09-19 08:41:18 -07:00
Brian Vaughn a0b66f405d Added FB copyright header 2019-08-27 10:54:01 -07:00
Brian Vaughn d96b8a5606 Merged changes from 4.0.0 -> 4.0.5 from DevTools fork 2019-08-20 11:34:51 -07:00
Brian Vaughn d517446749 Fixed standalone target not properly serving backend over localhost:8097 2019-08-19 07:36:41 -07:00
Brian Vaughn b738b77b4d Fixed standalone bug that prevented backend from being served over localhost:8097 2019-08-17 21:11:10 -07:00
Brian Vaughn 7461a14f40 Patched up react-devtools-core Webpack configs 2019-08-14 11:22:28 -07:00
Brian Vaughn 0fdcfc98b1 Fixed a bunch of Lint issues 2019-08-13 21:59:07 -07:00
Brian Vaughn 73aec5cc57 Prettier 2019-08-13 17:58:03 -07:00
Brian Vaughn 9ad43bcd59 Misc Flow and import fixes
1. Fixed all reported Flow errors
2. Added a few missing package declarations
3. Deleted ReactDebugHooks fork in favor of react-debug-tools
2019-08-13 17:53:28 -07:00
Brian Vaughn 0da4f3f4aa Reorganized folders into packages/* 2019-08-13 15:59:43 -07:00
Brian VaughnandGitHub 38838617d3 Refactor inspect/select logic so that $r contains hooks data (#364)
* Refactor inspect/select logic so that  var contains hooks data
* Legacy renderer resets $r to null when inspecting non class/function element
2019-08-03 17:59:35 -07:00
Brian Vaughn 0594bad748 Add "Welcome to the new DevTools" notification
This dialog is shown in the browser extension the first time a user views v4. It is off by default for the standalone extension, but can be enabled via a public API.
2019-07-31 11:22:51 -07:00
Brian Vaughn 3ea9d5e21e Re-enable "view source" button for standalone shell
But only do this if we can verify the element file path. This hopefully avoids the case where clicking the button does nothing because of an invalid/incomplete path.
2019-07-25 09:28:45 -07:00
Brian Vaughn b8b965b2d6 Disable view-source button in standalone mode if no project roots are provided 2019-07-24 13:36:51 -07:00
Brian Vaughn c97d48c792 Misc improvements based on user feedback from Tim
* Added shadow to modals
* Change default "collapse new nodes" to be disabled rather than enabled
* Changed setting label "Collapse newly added components by default" to "Expand component tree by default"
* Change CSS media query for settings popup to show labels at smaller size
* Hide "Inspect the matching DOM element" button (since it doesnt really serve a purpose in standalone)
* Fixed small size bug for settings icon (viewbox of 20x20 instead of 24x24)
* bugfix: window.addEventListener/window.removeEventListener is not defined in Hermes.
2019-07-24 11:25:11 -07:00
Brian VaughnandGitHub f3f253a946 Improve Bridge Flow types (#352)
* Updated local fork of react-window
* Updated Fow 97 -> 103
* Lint ignore NPM dist
* Improved Bridge Flow types
2019-07-20 14:08:23 -07:00
Brian Vaughn d128ff94af Detect React Native v3 backend and show warning 2019-07-18 16:24:22 -07:00
Brian VaughnandGitHub 2bd3e3d82b Patch console to append component stacks (#348)
* Patch console.warn and console.error to auto-append owners-only component stacks.

This setting is enabled by default and will work for React Native even if no front-end DevTools shell is being used. The setting can be disabled via a new, persisted user preference though.
2019-07-17 11:12:39 -07:00
Brian VaughnandGitHub 9947afac19 Standalone NPM packages and React Native support (#335)
* Add version 4 react-devtools and react-devtools-core packages which support both React Native and e.g. Safari or iframe DOM usage.
* Replaces typed operations arrays with regular arrays in order to support Hermes. This is unfortunate, since in theory a typed array buffer could be more efficiently transferred between frontend and backend for the web extension, but this never actually worked properly in v8, only Spidermonkey, and it fails entirely in Hermes so for the time being- it's been removed.
* Adds support for React Native (paper renderer)
* Adds a style editor for react-native and react-native-web
2019-07-13 10:05:04 -07:00