Commit Graph

166 Commits

Author SHA1 Message Date
oltrep
f668b6c351 Bump to latest eslint-config-fbjs (#20029)
* bump package to latest

* update files to respect lint

* disable object-type-delimiter rule to work with prettier

* disable rule to let flow check pass
2020-10-16 16:06:08 +01:00
IDrissAitHafid
2eb3181eb4 fixed unfound node error when Suspense is filtered (#20019)
* fixed unfound node error when Suspense is filtered

* added a test for filtered Suspense node
2020-10-15 14:45:23 -04:00
Brian Vaughn
f75f8b48a2 DevTools always overrides the dispatcher when shallow rendering (#20011)
This is done so that any effects scheduled by the shallow render are thrown away.

Unlike the code this was forked from (in ReactComponentStackFrame) DevTools should override the dispatcher even when DevTools is compiled in production mode, because the app itself may be in development mode and log errors/warnings.
2020-10-14 13:19:47 -04:00
IDrissAitHafid
e614e69657 handled a missing suspense fiber when suspense is filtered on the profiler (#19987)
Co-authored-by: Brian Vaughn <bvaughn@fb.com>
2020-10-13 13:38:58 -04:00
Brian Vaughn
7559722a86 Fix bad null check in DevTools highlight code (#20010) 2020-10-13 13:08:12 -04:00
Nick Reiley
7e405d458d [DevTools] Add DevTools forked Feature flags (#18994)
Also resolve an uncaught error in extension build (#18843).

Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
Co-authored-by: Brian Vaughn <bvaughn@fb.com>
2020-10-12 13:07:10 -04:00
Brian Vaughn
461cd84944 Revert "DevTools: Improve browser extension iframe support (#19854)" (#19959)
This reverts commit a99bf5c5f4.
2020-10-05 09:44:08 -04:00
6h057
a99bf5c5f4 DevTools: Improve browser extension iframe support (#19854)
Co-authored-by: Joel DSouza <joel.dsouza@kapturecrm.com>
Co-authored-by: Damien Maillard <damien.maillard@dailymotion.com>
Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-09-23 16:56:13 -04:00
Todor Totev
92c7e49895 Don't consumer iterators while inspecting (#19831)
Co-authored-by: Brian Vaughn <bvaughn@fb.com>
2020-09-22 14:23:20 -04:00
Brian Vaughn
a8de69f358 DevTools: Drop IE 11 support (#19875)
DevTools shared Babel config previously supported IE 11 to target Hermes (for the standalone backend that gets embedded within React Native apps). This targeting resulted in less optimal code for other DevTools targets though which did not need to support IE 11. This PR updates the shared config to remove IE 11 support by default, and only enables it for the standalone backend target.
2020-09-21 11:07:45 -04:00
Brian Vaughn
50d9451f32 Improve DevTools editing interface (#19774)
* Improve DevTools editing interface

This commit adds the ability to rename or delete keys in the props/state/hooks/context editor and adds tests to cover this functionality. DevTools will degrade gracefully for older versions of React that do not inject the new reconciler rename* or delete* methods.

Specifically, this commit includes the following changes:
* Adds unit tests (for modern and legacy renderers) to cover overriding props, renaming keys, and deleting keys.
* Refactor backend override methods to reduce redundant Bridge/Agent listeners and methods.
* Inject new (DEV-only) methods from reconciler into DevTools to rename and delete paths.
* Refactor 'inspected element' UI components to improve readability.
* Improve auto-size input to better mimic Chrome's Style editor panel. (See this Code Sandbox for a proof of concept.)

It also contains the following code cleanup:
* Additional unit tests have been added for modifying values as well as renaming or deleting paths.
* Four new DEV-only methods have been added to the reconciler to be injected into the DevTools hook: overrideHookStateDeletePath, overrideHookStateRenamePath, overridePropsDeletePath, and overridePropsRenamePath. (DevTools will degrade gracefully for older renderers without these methods.)
* I also took this as an opportunity to refactor some of the existing code in a few places:
  * Rather than the backend implementing separate methods for editing props, state, hooks, and context– there are now three methods: deletePath, renamePath, and overrideValueAtPath that accept a type argument to differentiate between props, state, context, or hooks.
  * The various UI components for the DevTools frontend have been refactored to remove some unnecessary repetition.

This commit also adds temporary support for override* commands with mismatched backend/frontend versions:
* Add message forwarding for older backend methods (overrideContext, overrideHookState, overrideProps, and overrideState) to the new overrideValueAtPath method. This was done in both the frontend Bridge (for newer frontends passing messages to older embedded backends) and in the backend Agent (for older frontends passing messages to newer backends). We do this because React Native embeds the React DevTools backend, but cannot control which version of the frontend users use.
* Additional unit tests have been added as well to cover the older frontend to newer backend case. Our DevTools test infra does not make it easy to write tests for the other way around.
2020-09-18 11:07:18 -04:00
Brian Vaughn
26857ecfa9 Revert "DevTools: Improve browser extension iframe support (#19827)" (#19852)
This reverts commit ec39a5e901.
2020-09-17 14:57:44 -04:00
6h057
ec39a5e901 DevTools: Improve browser extension iframe support (#19827)
Co-authored-by: Joel DSouza <joel.dsouza@kapturecrm.com>
Co-authored-by: Damien Maillard <damien.maillard@dailymotion.com>
Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-09-14 10:04:46 -04:00
6h057
917cb01a58 React DevTools: Show symbols used as keys in state (#19786)
Co-authored-by: Brian Vaughn <bvaughn@fb.com>
2020-09-14 09:55:19 -04:00
Andrew Clark
d17086c7c8 Decouple public, internal act implementation (#19745)
In the next major release, we intend to drop support for using the `act`
testing helper in production. (It already fires a warning.) The
rationale is that, in order for `act` to work, you must either mock the
testing environment or add extra logic at runtime. Mocking the testing
environment isn't ideal because it requires extra set up for the user.
Extra logic at runtime is fine only in development mode — we don't want
to slow down the production builds.

Since most people only run their tests in development mode, dropping
support for production should be fine; if there's demand, we can add it
back later using a special testing build that is identical to the
production build except for the additional testing logic.

One blocker for removing production support is that we currently use
`act` to test React itself. We must test React in both development and
production modes.

So, the solution is to fork `act` into separate public and
internal implementations:

- *public implementation of `act`* – exposed to users, only works in
  development mode, uses special runtime logic, does not support partial
  rendering
- *internal implementation of `act`* – private, works in both
  development and productionm modes, only used by the React Core test
  suite, uses no special runtime logic, supports partial rendering (i.e.
  `toFlushAndYieldThrough`)

The internal implementation should mostly match the public
implementation's behavior, but since it's a private API, it doesn't have
to match exactly. It works by mocking the test environment: it uses a
mock build of Scheduler to flush rendering tasks, and Jest's mock timers
to flush Suspense placeholders.

---

In this first commit, I've added the internal forks of `act` and
migrated our tests to use them. The public `act` implementation is
unaffected for now; I will leave refactoring/clean-up for a later step.
2020-09-08 08:11:45 -07:00
Andrew Clark
1665443603 Rename effect fields (#19755)
- `effectTag` -> `flags`
- `subtreeTag` -> `subtreeFlags`
2020-09-04 14:34:07 -07:00
E-Liang Tan
eabd18c73f Scheduling Profiler: Move preprocessing to web worker and add loading indicator (#19759)
* Move preprocessData into a web worker
* Add UI feedback for loading/import error states
* Terminate worker when done handling profile
* Add display density CSS variables
2020-09-04 10:57:32 -04:00
E-Liang Tan
38a512acad Scheduling Profiler: Redesign with DevTools styling (#19707)
Co-authored-by: Brian Vaughn <bvaughn@fb.com>
2020-09-03 12:08:40 -04:00
Meghnath Pillay
835c11eba7 Add checkbox toggle for boolean values (#19714)
* added a checkbox which appears to the right of a value when value is boolean
* checkbox with toggle capability created for boolean props

Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-09-03 08:57:12 -04:00
Brian Vaughn
98dba66ee1 Add ⎇ + arrow key navigation to DevTools (#19741)
⎇ + left/right navigates between owners (similar to owners tree) and ⎇ + up/down navigations between siblings.
2020-09-01 20:03:44 -04:00
Ben Pernick
60ba723bf7 Add SuspenseList to devTools (#19684)
* ensure getDisplayName is only called on functions

* add SuspenseList to Dev tools element names

* Add SuspenseList and pass tests

* Import SuspenseList directly

* run prettier

* Refactor tests to use real components

* run linter
2020-08-26 18:04:43 +01:00
6h057
49af88991c Fix DevTools crash when inspecting document.all (#19619)
* Add html_all_collection type to correct typeof document.all

* process HTMLAllCollection like HTMLElement + fix flow issue

* fix lint

* move flow fix comment

* Make it work with iframes too

* optimize how we get html_all_collection type

* use once Object.prototype.toString.call
2020-08-21 14:31:16 +01:00
E-Liang Tan
c641b611c4 Upgrade all @babel/* packages to fix DevTools builds on newer Node versions (#19647) 2020-08-20 11:47:16 -04:00
Sam Marks
c45a195429 fix: property list values should show whitespace (#19640) 2020-08-19 08:50:46 -04:00
CY Lim
702fad4b1b refactor fb.me redirect link to reactjs.org/link (#19598)
* refactor fb.me url to reactjs.org/link

* Update ESLintRuleExhaustiveDeps-test.js

* Update ReactDOMServerIntegrationUntrustedURL-test.internal.js

* Update createReactClassIntegration-test.js

* Update ReactDOMServerIntegrationUntrustedURL-test.internal.js

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
2020-08-17 13:25:50 +01:00
Pascal Fong Kye
b6e1d08604 DevTools bug fix: Proxied methods should be safely dehydrated for display 2020-08-12 12:15:53 -04:00
Brian Vaughn
0c52e24cb6 Support inner component _debugOwner in memo (#19556)
* Support inner component _debugOwner in memo

* test with devtool context

* remove memo test

* Merged master; tweaked test and snapshot

* Pass owner to createFiber fn when creating a memo component.

Co-authored-by: Theodore Han <tqhan317@gmail.com>
2020-08-10 10:49:10 -04:00
Dominic Gannaway
b61174fb7b Remove the deprecated React Flare event system (#19520) 2020-08-05 15:13:29 +01:00
Brian Vaughn
a89854bc93 Fix Suspense-wrapping heuristic (and bump version numbers) (#19373)
* Fixed suspense wrapping heuristic

* Bump package numbers 16.13.1 -> 17.0.0-alpha.0 to fix DevTools Suspense heuristic
2020-07-15 12:25:27 -04:00
Dominic Gannaway
45eef8b6b5 Devtools: improve getID guard (#19364) 2020-07-15 14:17:48 +01:00
Brian Vaughn
fbc6386369 Fix DevTools handling of empty Suspense tag for legacy renderer versions (#19337) 2020-07-13 16:21:56 -04:00
Brian Vaughn
d5d659062d Updated DevTools test snapshots 2020-07-10 13:06:50 -04:00
Nick Reiley
17efbf7d63 [DevTools] Show HOC names in profiler (#19283)
* show hoc names in profiler

* Added hocDisplayNames.length check

Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-07-10 11:21:19 -04:00
Dan Abramov
8eaf05e0e8 DevTools: Make break-on-warn off by default (#19309) 2020-07-10 14:11:32 +01:00
finico
ed94600fc6 Remove unnecessary tag end from CommitRanked view (#19195) 2020-06-25 12:10:47 -04:00
Brian Vaughn
1cfd332fd7 Shutdown DevTools Bridge synchronously when unmounting (#19180) 2020-06-23 11:48:04 -04:00
Andrew Clark
6ba25b96df Bugfix: Legacy Mode + DevTools "force fallback" (#19164)
DevTools has a feature to force a Suspense boundary to show a fallback.
This feature causes us to skip the first render pass (where we render
the primary children) and go straight to rendering the fallback.

There's a Legacy Mode-only codepath that failed to take this scenario
into account, instead assuming that whenever a fallback is being
rendered, it was preceded by an attempt to render the primary children.

SuspenseList can also cause us to skip the first pass, but the relevant
branch is Legacy Mode-only, and SuspenseList is not supported in
Legacy Mode.

Fixes a test that I had temporarily disabled when upstreaming the Lanes
implementation in #19108.
2020-06-19 11:06:42 -07:00
Ricky
30b47103d4 Fix spelling errors and typos (#19138) 2020-06-15 19:59:44 -04:00
Rick Hanlon
655affa302 Clarifications
Co-authored-by: shengxinjing <316783812@qq.com>
2020-06-12 21:09:29 -04:00
Andrew Clark
8f05f2bd6d Land Lanes implementation in old fork (#19108)
* Add autofix to cross-fork lint rule

* replace-fork: Replaces old fork contents with new

For each file in the new fork, copies the contents into the
corresponding file of the old fork, replacing what was already there.

In contrast to merge-fork, which performs a three-way merge.

* Replace old fork contents with new fork

First I ran  `yarn replace-fork`.

Then I ran `yarn lint` with autofix enabled. There's currently no way to
do that from the command line (we should fix that), so I had to edit the
lint script file.

* Manual fix-ups

Removes dead branches, removes prefixes from internal fields.  Stuff
like that.

* Fix DevTools tests

DevTools tests only run against the old fork, which is why I didn't
catch these earlier.

There is one test that is still failing. I'm fairly certain it's related
to the layout of the Suspense fiber: we no longer conditionally wrap the
primary children. They are always wrapped in an extra fiber.

Since this has been running in www for weeks without major issues, I'll
defer fixing the remaining test to a follow up.
2020-06-11 20:05:15 -07:00
Brian Vaughn
2efe63d99c 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 Vaughn
aefb97e6bb DevTools: Add root and renderer version to inspected props panel (#18963)
* DevTools: Add root and renderer version to inspected props panel
* Removed redundant .length check
2020-05-21 14:40:49 -07:00
Brian Vaughn
099f73710e DevTools: Improve error boundary (#18956)
1. Add support for dark mode
2. Add retry option for case where Profiler data is corrupted
2020-05-21 11:21:22 -07:00
Brian Vaughn
c93a6cb4d5 DevTools: Fix highlight updates Canvas side problem (#18973) 2020-05-21 10:04:37 -07:00
Brian Vaughn
5aa967b69b DevTools editable props tweaks (#18954)
1. Made non-editable prop text higher contrast (easier to read)
2. Also makes it stand out as different from dimmer placeholder text for "new prop"
2020-05-19 09:42:00 -07:00
Nick Reiley
d897c35ecf [DevTools] Add Component Highlighting to Profiler (#18745)
Co-authored-by: Moji Izadmehr <m.eezadmehr@gmail.com>
Co-authored-by: Brian Vaughn <bvaughn@fb.com>
2020-05-18 11:13:16 -07:00
Nick Reiley
dd2e36df33 Profiler: Skip reading element for imported data (#18913)
* skip reading element for imported data

* rename nodes & enable store lookup for components tab

* replace names

* Added some more test coverage; reverted rename

Co-authored-by: Brian Vaughn <bvaughn@fb.com>
2020-05-15 10:38:01 -07:00
Nick Reiley
7c080902ef [DevTools] Improve HOC search UX (#18802)
Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-05-15 10:37:34 -07:00
Nick Reiley
a3fccd2567 Fix Profiler root change error (#18880) 2020-05-12 15:47:23 -07:00
Karl Horky
2b9d7cf65f Devtools: Show inspectedElement key in right pane (#18737)
* Start MVP for showing inspected element key

* Add key in other places

* Add key from backend

* Remove unnecessary hydrateHelper call

* Hide copy button when no label

* Move above props

* Revert changes to InspectedElementTree.js

* Move key to left of component name

* Updated CSS

Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-05-11 13:17:13 -07:00