Commit Graph
14069 Commits
Author SHA1 Message Date
Brian VaughnandGitHub 15fed0570a Update DevTools Error strings to support GitHub fuzzy search (#21314) 2021-04-19 13:05:28 -04:00
Andrew ClarkandGitHub b6c538d2a3 Revert expiration for retry lanes (#21300)
Retries should be allowed to expire if they are CPU bound for too long,
but when I made this change it caused a spike in browser crashes. There
must be some other underlying bug; not super urgent but ideally should
figure out why and fix it. Unfortunately we don't have a repro for the
crashes, only detected via production metrics.
2021-04-16 16:45:09 -05:00
Brian VaughnandGitHub 4db9384ea6 Fix DevTools test target (#21267) 2021-04-16 16:19:05 -04:00
Brian Vaughn d987e536a3 DevTools version bump 4.12.1 -> 4.12.2 2021-04-16 12:35:29 -04:00
Brian VaughnandGitHub 85217a9c5b DevTools fork console patching logic (#21301)
React has its own component stack generation code that DevTools embeds a fork of, but both of them use a shared helper for disabling console logs. This shared helper is DEV only though, because it was intended for use with React DEV-only warnings and we didn't want to unnecessarily add bytes to production builds.

But DevTools itself always ships as a production build– even when it's used to debug DEV bundles of product apps (with third party DEV-only warnings). That means this helper was always a noop.

The resolveCurrentDispatcher method was changed recently to replace the thrown error with a call to console.error. This newly logged error ended up slipping through and being user visible because of the above issue.

This PR updates DevTools to also fork the console patching logic (to remove the DEV-only guard).

Note that I didn't spot this earlier because my test harness (react-devtools-shell) always runs in DEV mode. 🤡
2021-04-16 12:01:47 -04:00
Brian VaughnandGitHub 7889613b74 DevTools pre-filter GH issues by repo (#21292) 2021-04-15 19:56:41 -04:00
Sebastian MarkbågeandGitHub 25ee357cb2 Mark boundary as client rendered even if aborting fallback (#21294) 2021-04-15 19:16:40 -04:00
RickyandGitHub fbd7519cef Also turn off enableSyncDefaultUpdates in RN test renderer (#21293) 2021-04-15 16:31:46 -04:00
RickyandGitHub 36908475c8 Add dynamic flags to React Native (#21291)
* Add dynamic flags to React Native

* Hardcode the setting to false instead
2021-04-15 15:30:09 -04:00
Brian VaughnandGitHub 63c495d451 DevTools error boundary: Search for pre-existing GH issues (#21279) 2021-04-15 13:34:54 -04:00
Sebastian MarkbågeandGitHub 83d4aefe2d [Fizz] Two More Fixes (#21288)
* Emit value of option tags

* Mask the legacy context passed to classes
2021-04-15 10:26:49 -07:00
Sebastian MarkbågeandGitHub bfeebcc862 Fix classes (#21283) 2021-04-15 08:06:31 -07:00
Sebastian MarkbågeandGitHub 1fd681e4cd [Fizz] Random Fixes (#21277) 2021-04-14 23:29:30 -04:00
Sebastian MarkbågeandGitHub 832f2999f3 Gate a test (#21275)
Rebase error
2021-04-14 16:37:44 -07:00
Sebastian MarkbågeandGitHub 7f2b741443 Always insert a dummy node with an ID into fallbacks (#21272) 2021-04-14 15:39:51 -07:00
Sebastian MarkbågeandGitHub 6488abdb01 Emit reactroot attribute on the first element we discover (#21154)
This may not be the first root element if the root is a fragment and the
second one unsuspends first. But this tag doesn't work well for root
fragments anyway.
2021-04-14 15:09:22 -07:00
Sebastian MarkbågeandGitHub 84f5c6b767 [Fizz] Add unsupported Portal/Scope components (#21261)
* Update Portal error message

* Add Scope Component
2021-04-14 14:35:36 -07:00
Sebastian MarkbågeandGitHub 36ad2f8d09 Implement useOpaqueIdentifier (#21260)
The format of this ID is specific to the format.
2021-04-14 14:25:42 -07:00
Sebastian MarkbågeandGitHub 589cd04a3c [Fizz] Implement Hooks (#21257)
* Implement Fizz Hooks

This is pretty much just a copy of the partial renderer Hooks.

* Implement forward ref and memo
2021-04-14 14:16:41 -07:00
Sebastian MarkbågeandGitHub 56cfb43dba [Fizz] Fix reentrancy bug (#21270)
* Fix reentrancy bug

* Fix another reentrancy bug

There's also an issue if we try to schedule something to be client
rendered if its fallback hasn't rendered yet. So we don't do it
in that case.
2021-04-14 13:49:14 -07:00
Brian VaughnandGitHub c237bfb8d2 DevTools should use reconciler version (rather than renderer version)
when available (#21269)
2021-04-14 14:48:05 -04:00
Brian VaughnandGitHub 409ebec173 Reconciler should inject its own version into DevTools hook (#21268) 2021-04-14 14:47:36 -04:00
Sebastian MarkbågeandGitHub c38a04fe64 [Fizz] Implement New Context (#21255)
* Add NewContext module

This implements a reverse linked list tree containing the previous
contexts.

* Implement recursive algorithm

This algorithm pops the contexts back to a shared ancestor on the way down
the stack and then pushes new contexts in reverse order up the stack.

* Move isPrimaryRenderer to ServerFormatConfig

This is primarily intended to be used to support renderToString with a
separate build than the main one. This allows them to be nested.

* Wire up more element type matchers

* Wire up Context Provider type

* Wire up Context Consumer

* Test

* Implement reader in class

* Update error codez
2021-04-14 11:45:42 -07:00
Brian VaughnandGitHub f4d011491f Fixed bug in react-detools-inline frontend init method (#21265) 2021-04-14 13:27:21 -04:00
Henry Q. DineenandGitHub f112dbffb1 remove obsolete SharedArrayBuffer ESLint config (#21259) 2021-04-14 12:55:23 -04:00
Paul O’ShannessyandGitHub d21113f231 Update code of conduct (#21251)
We are updating our code of conduct to include activities outside the project.

https://developers.facebook.com/blog/post/2021/04/12/facebook-open-source-ally/
2021-04-13 19:33:31 -04:00
Sebastian MarkbågeandGitHub 00b6750584 [Fizz] Classes Follow Up (#21253)
* Port Classes from Fiber to Fizz

* Test
2021-04-13 13:57:36 -07:00
Brian VaughnandGitHub 0f43470e40 Add createBridge and createStore exports to react-devtools-inline (for Replay integration) (#21032) 2021-04-12 17:07:14 -04:00
Joshua GrossandGitHub d3355e840c Prevent reading canonical property of null (#21242)
* Prevent reading canonical property of null

* prettier
2021-04-12 11:10:51 -07:00
Andrew ClarkandGitHub 170a94097b yarn test: Default to bleeding edge configuration (#21238)
My personal workflow is to develop against the www-modern release
channel, with the variant flags enabled, because it encompasses the
largest set of features. Then I rely on CI to run the tests against
all the other configurations.

So in practice, I almost always run

```
yarn test -r=www-modern --variant TEST_FILE
```

instead of

```
yarn test TEST_FILE
```

So, I've updated the `yarn test` command to use those options
by default.
2021-04-12 09:49:26 -07:00
Brian VaughnandGitHub 20a734f633 Fixed broken feature flag import for DT inline package (#21237) 2021-04-11 14:59:52 -04:00
Andrew ClarkandGitHub 14f4a85184 Bugfix: Don't rely on finishedLanes for passive effects (#21233)
I recently started using `pendingPassiveEffectsLanes` to check if there were any pending
passive effects (530027a). `pendingPassiveEffectsLanes` is the value of
`root.finishedLanes` at the beginning of the commit phase. When there
are pending passive effects, it should always be a non-zero value,
because it represents the lanes used to render the effects.

But it turns out that `root.finishedLanes` isn't always correct.
Sometimes it's `NoLanes` even when there's a new commit.

I found this while investigating an internal bug report. The only repro
I could get was via a headless e2e test runner; I couldn't get one in an
actual browser, or other interactive environment. I used the e2e test to
bisect and confirm the fix. But I don't know yet know how to write a
regression test for the precise underlying scenario. I can probably
reverse engineer one by studying the code; after a quick glance
at `performConcurrentWorkOnRoot` and `performSyncWorkOnRoot`, it's not
hard to see how this might happen.

In the meantime, I'll revert the recent change that exposed the bug.

I was surprised that this had never come up before, since the code that
assigns `root.finishedLanes` is in an extremely hot path, and it hasn't
changed in a while. The reason is that, before 530027a,
`root.finishedLanes` was only used by the DevTools profiler, which is
probably why we had never noticed any issues. In addition to fixing the
inconsistency, we might also consider making `finishedLanes` a
profiling-only field.
2021-04-11 02:09:41 -07:00
Sebastian MarkbågeandGitHub 2eee3c4153 [Fizz] Fragments and Iterable support (#21228) 2021-04-10 15:50:42 -04:00
RickyandGitHub 9e407d4b06 Make time-slicing opt-in (#21072)
* Add enableSyncDefaultUpdates feature flag

* Add enableSyncDefaultUpdates implementation

* Fix tests

* Switch feature flag to true by default

* Finish concurrent render whenever for non-sync lanes

* Also return DefaultLane with eventLane

* Gate interruption test

* Add continuout native event test

* Fix tests from rebasing main

* Hardcode lanes, remove added export

* Sync forks
2021-04-09 19:50:09 -04:00
Sebastian MarkbågeandGitHub 74ef65b1ff Support more empty types (#21225)
Undefined errors as a direct return value.

This changes semantics for "true" and functions to mirror the client.
2021-04-09 16:23:37 -07:00
Sebastian MarkbågeandGitHub c9509e6066 Merge isObject branches (#21226)
We assume that isArray and getIteratorFn are only called on objects.

So we shouldn't have to check that again and again, and then check a flag.

We can just stay in this branch.

There is a slight semantic breakage here because you could have an
iterator on a function, such as if it's a generator function. But that's
not supported and that currently only works at the root. The inner slots
don't support this.

So this just makes it consistent.
2021-04-09 16:19:13 -07:00
Brian VaughnandGitHub e4a3c060c3 Prepare DevTools CHANGELOG and versions for 4.11.0 release (#21221) 2021-04-09 19:12:13 -04:00
Sebastian MarkbågeandGitHub 7c0722a8bf Remove textarea special case from child fiber (#21222) 2021-04-09 14:02:13 -07:00
Brian VaughnandGitHub fdc7b79ef2 DevTools shows which fibers scheduled the current update (#21171) 2021-04-09 10:35:06 -04:00
Brian VaughnandGitHub dc7cce4f24 Track which fibers scheduled the current render work (#15658)
Tracked Fibers are called "updaters" and are exposed to DevTools via a 'memoizedUpdaters' property on the ReactFiberRoot. The implementation of this feature follows a vaguely similar approach as interaction tracing, but does not require reference counting since there is no subscriptions API.

This change is in support of a new DevTools Profiler feature that shows which Fiber(s) scheduled the selected commit in the Profiler.

All changes have been gated behind a new feature flag, 'enableUpdaterTracking', which is enabled for Profiling builds by default. We also only track updaters when DevTools has been detected, to avoid doing unnecessary work.
2021-04-09 10:34:33 -04:00
inokawaandGitHub 7e443eb18b Fix typo in comment (#21214) 2021-04-08 23:20:01 -04:00
Brian VaughnandGitHub 29a8f028c6 DevTools: Add post-commit hook (#21183)
I recently added UI for the Profiler's commit and post-commit durations to the DevTools, but I made two pretty silly oversights:

    1. I used the commit hook (called after mutation+layout effects) to read both the layout and passive effect durations. This is silly because passive effects may not have flushed yet git at this point.
    2. I didn't reset the values on the HostRoot node, so they accumulated with each commit.

    This commitR addresses both issues:

    1. First it adds a new DevTools hook, onPostCommitRoot*, to be called after passive effects get flushed. This gives DevTools the opportunity to read passive effect durations (if the build of React being profiled supports it).
    2. Second the work loop resets these durations (on the HostRoot) after calling the post-commit hook so address the accumulation problem.
    I've also added a unit test to guard against this regressing in the future.

    * Doing this in flushPassiveEffectsImpl seemed simplest, since there are so many places we flush passive effects. Is there any potential problem with this though?
2021-04-08 22:04:51 -04:00
Andrew ClarkandGitHub e015d4d4c3 Fix: Passive effect updates are never sync (#21215)
I screwed this up in #21082. Got confused by the < versus > thing again.

The helper functions are annoying, too, because I always forget the
intended order of the arguments. But they're still helpful because when
we refactor the type we only have the change the logic in one place.

Added a regression test.
2021-04-08 18:45:35 -07:00
Brian VaughnandGitHub 7956b41e54 Offscreen: Use JS stack to track hidden/unhidden subtree state (#21211) 2021-04-08 17:27:18 -04:00
Sebastian MarkbågeandGitHub 087889d900 Remove unnecessary processUpdateQueue (#21199)
We've just initialized the update queue above this and there's no user
code that executes between.

The general API that prevents this from mattering is that you can't
call setState in the constructor.
2021-04-08 11:14:51 -07:00
Sebastian MarkbågeandGitHub 558cb234a7 [Fizz] Implement Classes (#21200)
* Legacy context

* Port Classes from Fiber to Fizz
2021-04-08 10:42:37 -07:00
Sebastian SilbermannandGitHub 6b717b3bdc Include actual type of Profiler#id on type mismatch (#20306) 2021-04-08 13:36:42 -04:00
Sebastian SilbermannandGitHub abf15a6cb5 test: Fix "couldn't locate all inline snapshots" (#21205) 2021-04-08 11:18:13 -04:00
wangaoandGitHub e22bf356bb style: delete unused isHost check (#21203) 2021-04-08 13:58:24 +01:00
Sebastian MarkbågeandGitHub 11ffb77098 Don't double invoke getDerivedStateFromProps for module pattern (#21193) 2021-04-07 16:20:25 -07:00