Compare commits

..

2094 Commits

Author SHA1 Message Date
Dan Abramov
5880d7bd66 Remove TestUtils dependency on event registry 2020-07-01 22:36:45 +01:00
Dan Abramov
9e7f5c02ca Make event plugin injection statically resolvable (#19234)
* Make plugins ESM

* Resolve extractEvents statically

* Resolve eventTypes statically

* Fix flow types and inconsistent naming

* Move injection into the plugin system itself

* Fix Flow
2020-07-01 22:11:05 +01:00
Dominic Gannaway
67eb6ff4a8 Add Flow to ModernChangeEventPlugin (#19232) 2020-07-01 21:49:03 +01:00
Dan Abramov
75b6921d64 Remove dead code from modern event system (#19233)
* Remove dead code from modern event system

* Remove SSR dependency on EventPluginRegistry
2020-07-01 21:04:14 +01:00
Dan Abramov
9fba65efa5 Enable modern event system and delete dead code (#19230) 2020-07-01 17:43:34 +01:00
Dan Abramov
e3f4eb7272 Fork legacy-events folder into react-dom and react-native (#19228) 2020-07-01 16:37:13 +01:00
Dominic Gannaway
cd0275dcb2 Fix responder logic in ReactDOMServerSelectiveHydration-test (#19227) 2020-07-01 16:28:49 +01:00
Dan Abramov
b231445f96 Move responder tests and remove dead code (#19226) 2020-07-01 16:20:49 +01:00
Dan Abramov
5707eeb2d2 Run ReactBrowserEventEmitter test on bundles (#19225)
* Run ReactBrowserEventEmitter test on bundles

* Rm bad tests
2020-07-01 16:01:46 +01:00
Dominic Gannaway
b2bac7311a Remove React Flare Keyboard responder (#19222) 2020-07-01 15:43:16 +01:00
Dan Abramov
f918b0eb41 Fix development mode hang when iframe is removed (#19220)
* Fix development mode hang when iframe is removed

* Also fix #16734
2020-07-01 15:33:29 +01:00
Dan Abramov
8bff8987e5 Don't bailout after Suspending in Legacy Mode (#19216)
* Add a failing test for legacy Suspense blocking context updates in memo

* Add more test case coverage for variations of #17356

* Don't bailout after Suspending in Legacy Mode

Co-authored-by: Tharuka Devendra <tsdevendra1@gmail.com>
2020-06-30 22:06:46 +01:00
Shailendra Gupta
f4097c1aef Added warning to <Context.Provider> in case no value prop is provided (#19054)
* added warning to context.provider in case no value prop

* update message

* updated message and pass undefined
2020-06-30 19:50:55 +01:00
Dan Abramov
47ff31a77a Revert "Add regression test for #18497 (#18538)" (#19215)
This reverts commit e9c1445ba0.
2020-06-30 13:38:31 +01:00
Vetrivel Chinnasamy
b621dab5d4 make link https (#19147) 2020-06-30 12:43:52 +01:00
jddxf
fa32cf299f Add regression tests where sync render causes later concurrent render to expire soon (#18608)
* Add a failing test for #17911

* Add more test cases where sync render causes later concurrent render to expire soon
2020-06-30 12:42:59 +01:00
Dan Abramov
1887c5d946 eslint-plugin-react-hooks@4.0.5 2020-06-30 12:16:49 +01:00
Fred Vollmer
b0533fe33c fix(eslint-plugin-react-hooks): Support optional chaining when accessing prototype method inside useCallback and useMemo #19061 (#19062)
* fix(eslint-plugin-react-hooks): Support optional chaining when accessing prototype method #19061

* run prettier

* Add fix for #19043
2020-06-30 12:14:00 +01:00
Sophie Alpert
e9c1445ba0 Add regression test for #18497 (#18538) 2020-06-30 12:09:05 +01:00
Brian Vaughn
9d9cf383c9 Fixed test script handling of unknown/additional args (#19209) 2020-06-29 15:36:45 -04:00
Dominic Gannaway
3c1a7ac87c Move TOP_BEFORE_BLUR to bubble phase (#19197) 2020-06-26 20:35:21 +01:00
Ricky
72bbcad160 Add new test cli (#19184)
* Add new test cli

* Remove --variant accidentally added to test-persist

* s/test/tests

* Updates from review

* Update package.json tests

* Missed a release channel in circle.yaml

* Update config.yml to use just run: with test commands

* Update release-channel options and add build dir checks

* Update test args to use the new release-channel options

* Fix error in circle config.yml

* Fix a wrong condition for the --variant check

* Fix a wrong condition for the --persistent check

* Prettier

* Require build check for devtool tests as well
2020-06-25 20:39:50 -04:00
Christoph Nakazawa
7d0e4150aa Fix react-runtime main field (#19193)
The "main" field in this package points to a non-existent file. This fixes it.
2020-06-25 12:17:42 -04:00
finico
ed94600fc6 Remove unnecessary tag end from CommitRanked view (#19195) 2020-06-25 12:10:47 -04:00
Chen Gang
ffe516f3bf use NoTimestamp instead of -1 (#19182) 2020-06-23 16:28:24 -04:00
Brian Vaughn
1425fcbb86 Re-enabled DebugTracing feature for old reconciler fork (#19161)
* Re-enabled DebugTracing feature for old reconciler fork

It was temporarily removed by @sebmarkbage via PR #18697. Newly re-added tracing is simplified, since the lane(s) data type does not require the (lossy) conversion between priority and expiration time values.

@sebmarkbage mentioned that he removed this because it might get in the way of his planned discrete/sync refactor. I'm not sure if that concern still applies, but just in case- I have only re-added it to the old reconciler fork for now.

* Force Code Sandbox CI to re-run
2020-06-23 12:16:23 -04:00
Brian Vaughn
0836f62a5b Updates the DevTools test script to make it easier to test other URLs. (#19179) 2020-06-23 11:48:35 -04:00
Brian Vaughn
1cfd332fd7 Shutdown DevTools Bridge synchronously when unmounting (#19180) 2020-06-23 11:48:04 -04:00
Jack Works
5b98656909 fix: use define property to overwrite console, close #19099 (#19123)
* fix: use define property to overwrite console, close #19099

* fix: lint error
2020-06-23 10:34:53 -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
Luna Ruan
d1d9054e09 Revert "Re-enabled DebugTracing feature for old reconciler fork (#19142)" (#19159)
This reverts commit cc7c1aece4.
2020-06-18 18:18:56 -07:00
YeonJuan
090c6ed751 [eslint-plugin-react-hooks]: handling sparse array when no-inline callback (#19145) 2020-06-17 12:29:02 -04:00
Brian Vaughn
cc7c1aece4 Re-enabled DebugTracing feature for old reconciler fork (#19142)
It was temporarily removed by @sebmarkbage via PR #18697. Newly re-added tracing is simplified, since the lane(s) data type does not require the (lossy) conversion between priority and expiration time values.

@sebmarkbage mentioned that he removed this because it might get in the way of his planned discrete/sync refactor. I'm not sure if that concern still applies, but just in case- I have only re-added it to the old reconciler fork for now.
2020-06-16 15:16:15 -04:00
阿林
d4fc2c1457 Fix spelling (#19084) 2020-06-15 20:56:56 -04: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
103ed08c46 Remove shouldDeprioritizeSubtree from host config (#19124)
No longer being used.
2020-06-12 12:57:20 -07: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
Sebastian Markbåge
7f28234f84 Enable component stacks everywhere except RN (#19120)
This would still affect test renderer and isomorphic in RN.
2020-06-11 19:13:13 -07:00
Dominic Gannaway
e3ccdf1544 Remove synamic modern event system flag for FB (#19059)
* Remove synamic modern event system flag for FB
2020-06-11 19:49:45 +01:00
Andrew Clark
4c7036e807 Bugfix: Infinite loop in beforeblur event (#19053)
* Failing test: Infinite loop in beforeblur event

If the focused node is hidden by a Suspense boundary, we fire the
beforeblur event. Our check for whether a tree is being hidden isn't
specific enough. It should only fire when the tree is initially hidden,
but it's being fired for updates, too.

* Only fire beforeblur on visible -> hidden

Should only beforeblur fire if the node was previously visible. Not
during updates to an already hidden tree.

To optimize this, we should use a dedicated effect tag and mark it in
the render phase. I've left this for a follow-up, though. Maybe can
revisit after the planned refactor of the commit phase.

* Move logic to commit phase

isFiberSuspenseAndTimedOut is used elsewhere, so I inlined the commit
logic into the commit phase itself.
2020-06-01 09:01:21 -07:00
Sebastian Markbåge
1d85bb3ce1 Build FB specific Isomorphic Bundles (#19049)
We need this so we can version them separately and use different
feature flags than we use for OSS RN.

I put them in a separate facebook-react-native folder which won't go
into the RN GH repo. I plan on moving the renderers there too but not yet.
2020-05-29 15:32:38 -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
Sebastian Markbåge
89edb0eae3 Enable component stack locations in www (#19047) 2020-05-29 13:26:38 -07:00
Sebastian Markbåge
cb14168175 Remove unnecessary throw catch (#19044)
This was originally added so you could use "break on caught exceptions"
but that feature is pretty useless these days since it's used for feature
detection and Suspense.

The better pattern is to use the stack trace, jump to source and set a
break point here.

Since DevTools injects its own console.error, we could inject a "debugger"
statement in there. Conditionally. E.g. React DevTools could have a flag
to toggle "break on warnings".
2020-05-29 11:25:48 -07:00
Sebastian Markbåge
c03b8661a9 Upgrade Closure Compiler (#19041)
The Symbol bug has now been fixed so we can remove the hack that renames
the global variable.
2020-05-29 09:17:14 -07:00
Sebastian Markbåge
6d375f3078 Revert autofix lint (#19040)
I accidentally committed this since I had it on locally so I didn't have
to manually convert things to const.

However, this causes things to always pass lint since CI also runs this.
2020-05-28 20:32:34 -07:00
Sebastian Markbåge
8f511754db Prettier wants me to change this (#19039) 2020-05-28 20:13:56 -07:00
Sebastian Markbåge
2e7cc949ae Remove www builds of fetch (#19038)
I don't think we'll ever use this just because we have such a unique set up
for network delivery so we'll use something custom for this case.

Also, we don't need a profiling build for this since it doesn't have an
entry point.
2020-05-28 16:12:37 -07:00
Sebastian Markbåge
76f157e3dd Add simple Node build (#19022)
The webpack plugin doesn't really need a separate prod and dev build.
It also needs to be ES2015 otherwise we can't extend native classes.
2020-05-28 15:56:34 -07:00
Sebastian Markbåge
60afa3c117 Lint bundles using the bundle config instead of scanning for files (#19025)
* Lint bundles using the bundle config instead of scanning for files

This ensures that we look for all the files that we expect to see there.
If something doesn't get built we wouldn't detect it.

However, this doesn't find files that aren't part of our builds such as
indirection files in the root. This will need to change with ESM anyway
since indirection files doesn't work. Everything should be built anyway.

This ensures that we can use the bundles.js config to determine special
cases instead of relying on file system conventions.

* Run lint with flag
2020-05-28 15:04:25 -07:00
Sebastian Markbåge
518ce9c25f Add Lazy Elements Behind a Flag (#19033)
We really needed this for Flight before as well but we got away with it
because Blocks were lazy but with the removal of Blocks, we'll need this
to ensure that we can lazily stream in part of the content.

Luckily LazyComponent isn't really just a Component. It's just a generic
type that can resolve into anything kind of like a Promise.

So we can use that to resolve elements just like we can components.

This allows keys and props to become lazy as well.

To accomplish this, we suspend during reconciliation. This causes us to
not be able to render siblings because we don't know if the keys will
reconcile. For initial render we could probably special case this and
just render a lazy component fiber.

Throwing in reconciliation didn't work correctly with direct nested
siblings of a Suspense boundary before but it does now so it depends
on new reconciler.
2020-05-28 14:16:35 -07:00
Sebastian Markbåge
4985bb0a80 Rename 17 to 18 in warnings (#19031)
We're not really supposed to refer to future versions by numbers.

These will all slip so these numbers don't make sense anymore.
2020-05-28 10:25:39 -07:00
Brian Vaughn
86b4070ddb Cleaned up passive effects experimental flags (#19021) 2020-05-28 08:32:37 -07:00
Sebastian Markbåge
607148673b Remove ReactComponentTreeHook from internals (#19032)
We don't really support mixing minor versions anymore anyway. But seems
safe to remove in 17.
2020-05-27 20:41:13 -07:00
Sebastian Markbåge
43e59f29d6 Delete Entries without Build Output from package.json and the build directory (#19029)
* Gate test

* Delete entrypoints without Build Outputs from package.json and build output

If an entry point exists in bundles.js but doesn't have any bundleTypes,
I delete that entry point file from the build directory. I also remove it
from the files field in package.json if it exists.

This allows us to remove bundles from being built in the stable release
channel.
2020-05-27 19:43:08 -07:00
Sebastian Markbåge
e668f1b54f Remove unstable-fire from package.json (#19026)
This hasn't existed for a while now.
2020-05-27 17:07:25 -07:00
Sebastian Markbåge
0219925e02 Remove regenerator from noop (#19024)
This isn't used and it wouldn't work anyway.
2020-05-27 16:14:46 -07:00
Sebastian Markbåge
c66ac10f4d Lint classic www build (#19023) 2020-05-27 14:13:54 -07:00
Dan Abramov
b41beb1a35 Revert "Fix mistyped script arbitrary code execution vulnerability (#18660)" (#19018)
This reverts commit e5cc1462b3.
2020-05-27 17:37:27 +01:00
Sebastian Markbåge
55cb0b7eeb Only prepare extra stack frames if needed (#19014)
We currently prepare an extra stack frame before they're needed.
Particularly for propTypes. This causes problems as they can have
side-effects with the new component stacks and it's slow.

This moves it to be lazy.
2020-05-27 08:43:50 -07:00
Aaron Pettengill
9752d31f12 Document additionalHooks option (#19005)
* Document `additionalHooks` option

* Update README.md

Co-authored-by: Aaron Pettengill <aaron.pettengill@echoman.com>
Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
2020-05-27 15:27:43 +01:00
Dan Abramov
b7ff888190 eslint-plugin-react-hooks@4.0.4 2020-05-27 14:38:27 +01:00
Andrew Clark
18de3b6e7c Bug: Spawning hydration in response to Idle update (#19011)
* Bug: Spawning hydration in response to Idle update

Adds a test that fails in the new fork.

* Fix typos related to Idle priority

These are just silly mistakes that weren't caught by any of our tests.

There's a lot of duplication in the Lanes module right now. It's also
not super stable as we continue to refine our heuristics. Hopefully the
final state is simpler and less prone to these types of mistakes.
2020-05-26 18:53:50 -07:00
Andrew Clark
9273e6585f Disable DevTools build job to unblock master (#19012) 2020-05-26 18:52:58 -07:00
Toru Kobayashi
fb735423bb Fix rollup validate script (#18900)
* Revert "Revert "deps: update ESLint version to v7 (#18897)" (#18899)"

This reverts commit 84fd4b853f.

* fix rollup validate script
2020-05-27 01:19:32 +01:00
Julien Deniau
8abc202c7f [eslint-plugin-react-hooks] Prefer recommended eslint configuration (#18951)
* [eslint-plugin-react-hooks] Prefer recommended eslint configuration

* Update README.md

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
2020-05-27 01:08:41 +01:00
Yann アウネ Eves
4821d609e9 fix(eslint-plugin-react-hooks): Added matching for nullish coalescing and optional chaining of dependencies, relates to #18985 (#19008) 2020-05-27 01:07:10 +01:00
Brian Vaughn
a012858ba9 Move isCustomComponent() function call outside of loop (#19007) 2020-05-26 13:41:27 -07:00
Dan Abramov
67e130fc68 eslint-plugin-react-hooks@4.0.3 2020-05-26 16:11:08 +01:00
Dan Abramov
bb2239dc90 Revert "Feature: Add support to exhaustive-deps rule for any hook ending with Effect (#18580)" (#19004)
This reverts commit 5ac9ca72df.
2020-05-26 16:08:50 +01:00
Andrew Clark
03e6b8ba2f Make LegacyHidden match semantics of old fork (#18998)
Facebook currently relies on being able to hydrate hidden HTML. So
skipping those trees is a regression.

We don't have a proper solution for this in the new API yet. So I'm
reverting it to match the old behavior.

Now the server renderer will treat LegacyHidden the same as a fragment,
with no other special behavior. We can only get away with this because
we assume that every instance of LegacyHidden is accompanied by a host
component wrapper. In the hidden mode, the host component is given a
`hidden` attribute, which ensures that the initial HTML is not visible.
To support the use of LegacyHidden as a true fragment, without an extra
DOM node, we will have to hide the initial HTML in some other way.
2020-05-25 18:16:53 -07:00
Dan Abramov
3ca1904b37 react-refresh@0.8.3 2020-05-23 14:26:26 +01:00
yjimk
0aa4cc544c Resolve an edge case where ref.node can be falsy (#18984)
Co-authored-by: Jimmy Cann <jimmy.cann@ironstar.io>
2020-05-23 14:25:24 +01:00
Brian Vaughn
8f4dc3e5d0 Warn if MutableSource snapshot is a function (#18933)
* Warn if MutableSource snapshot is a function

useMutableSource does not properly support snapshots that are functions. In part this is because of how it is implemented internally (the function gets mistaken for a state updater function). To fix this we could just wrap another function around the returned snapshot, but this pattern seems problematic to begin with- because the function that gets returned might itself close over mutable values, which would defeat the purpose of using the hook in the first place.

This PR proposes adding a new DEV warning if the snapshot returned is a function. It does not change the behavior (meaning that a function could still work in some cases- but at least the current behavior prevents passing around a closure that may later become stale unless you're really intentional about it e.g. () => () => {...}).

* Replaced .warn with .error
2020-05-21 16:14:29 -07:00
Brian Vaughn
142d4f1c00 useMutableSource hydration support (#18771)
* useMutableSource hydration support

* Remove unnecessary ReactMutableSource fork

* Replaced root.registerMutableSourceForHydration() with mutableSources option

* Response to PR feedback:

1. Moved mutableSources root option to hydrationOptions object
2. Only initialize root mutableSourceEagerHydrationData if supportsHydration config is true
3. Lazily initialize mutableSourceEagerHydrationData on root object
2020-05-21 16:00:46 -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
Andrew Clark
74394aa8cb Add unstable_isNewReconciler to dispatcher (#18975)
This is a bit gross but I need to be able to access it without importing
the renderer.

There might be a better way but I need this to unblock internal bugfix.
2020-05-21 11:56:00 -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
Dominic Gannaway
730ae7afa2 Clear fiber.sibling field when clearing nextEffect (#18970)
* Clear fiber.sibling field when clearing nextEffect
2020-05-21 18:53:56 +01:00
Brian Vaughn
c93a6cb4d5 DevTools: Fix highlight updates Canvas side problem (#18973) 2020-05-21 10:04:37 -07:00
Andrew Clark
f9bf828701 Add `unstable_isNewReconciler export to FB builds (#18974)
Should check this at runtime instead of the GK
2020-05-21 10:03:59 -07:00
Dominic Gannaway
4a3f779d67 Remove event pooling in the modern system (#18969) 2020-05-21 13:54:05 +01:00
Brian Vaughn
22f7663f14 Profiler: Don't count timed out (hidden) subtrees in base duration (#18966) 2020-05-20 18:36:57 -07:00
Andrew Clark
64f50c667a Remove disableHiddenPropDeprioritization flag (#18964)
This is rolled out to 100% public, so we can remove it.
2020-05-20 15:29:34 -07:00
Sebastian Markbåge
a30a1c6ef3 Transfer actualDuration only once for SuspenseList (#18959) 2020-05-20 15:12:38 -07:00
Andrew Clark
8b3b5c3524 Bugfix: Missing mode check in resetChildLanes (#18961)
Deferring a hidden tree is only supported in Concurrent Mode.

The missing check leads to an infinite loop when an update is scheduled
inside a hidden tree, because the pending work never gets reset.

This "accidentally" worked in the old reconciler because the heurstic
we used to detect offscreen trees was if `childExpirationTime`
was `Never`.

In the new reconciler, we check the tag instead. Which means we also
need to check the mode, like we do in the begin phase.

We should move this check out of the hot path. It shouldn't have been
in the hot path of the old reconciler, either.

Probably by moving `resetChildLanes` into the switch statement
in ReactFiberCompleteWork.
2020-05-19 23:10:49 -07:00
Andrew Clark
95ea8ed47c LegacyHidden: mode that defers without hiding (#18958)
Need this to unblock www. Not sure yet how we'll support this properly
long term.

While adding this, I noticed that the normal "hidden" mode of
LegacyHidden doesn't work properly because it doesn't toggle the
visibility of newly inserted nodes. This is fine for now since we only
use it via a userspace abstraction that wraps the children in an
additional node. But implementing this correctly is required for us
to start using it like a fragment, without the wrapper node.
2020-05-19 15:58:02 -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
Toru Kobayashi
dbf2bba632 remove an unused ISSUE_TEMPLATE.md (#18953) 2020-05-19 08:44:01 -07:00
Brian Vaughn
23309eb386 DevTools 4.6.0 -> 4.7.0 2020-05-18 14:16:04 -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
081b565cd7 [DevTools] enable Electron interactions on Linux & auto copy script tags (#18772)
Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-05-18 10:27:40 -07:00
Sebastian Silbermann
c390ab3643 Add test for displayName on React.memo components (#18925)
* Add test for displayName on React.memo components

* Added extra memo displayName test

Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-05-15 15:56:50 -07:00
Gabriele Prestifilippo
6ed5c2243f Add MIT license to use-subscription package (#18927)
This package is missing the license attribute (or a license file).

Being a sub-package of React, it should get the same license, however, none was specified.
A scan with `license_checker` would recognize this as `UNKNOWN`.
2020-05-15 15:36:48 -07:00
Brian Vaughn
8dba6691d0 Updated DevTools CHANGELOG for upcoming changes 2020-05-15 10:50:39 -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
Ricky Vetter
121af3143c Update inaccurate mapChildren comment (#18931)
The function you provide will only be passed a child and an index. It will not be passed a key. This is confirmed in the source, the Flow types, and the jsdoc comments.
2020-05-15 18:05:08 +01:00
Sophie Alpert
21dc41c320 Simplify logic for mutable workInProgressSources (#18920)
isPrimaryRenderer is always constant for a given React build, so these two arrays do nothing.
2020-05-14 14:30:44 -07:00
Andrew Clark
0fb747f368 Add LegacyHidden to server renderer (#18919)
* Add LegacyHidden to server renderer

When the tree is hidden, the server renderer renders nothing. The
contents will be completely client rendered.

When the tree is visible it acts like a fragment.

The future streaming server renderer may want to pre-render these trees
and send them down in chunks, as with Suspense boundaries.

* Force client render, even at Offscreen pri
2020-05-14 11:28:11 -07:00
Andrew Clark
b4a1a4980c Disable <div hidden /> API in old fork, too (#18917)
The motivation for doing this is to make it impossible for additional
uses of pre-rendering to sneak into www without going through the
LegacyHidden abstraction. Since this feature was already disabled in
the new fork, this brings the two closer to parity.

The LegacyHidden abstraction itself still needs to opt into
pre-rendering somehow, so rather than totally disabling the feature, I
updated the `hidden` prop check to be obnoxiously specific. Before, you
could set it to any truthy value; now, you must set it to the string
"unstable-do-not-use-legacy-hidden".

The node will still be hidden in the DOM, since any truthy value will
cause the browser to apply a style of `display: none`.

I will have to update the LegacyHidden component in www to use the
obnoxious string prop. This doesn't block merge, though, since the
behavior is gated by a dynamic flag. I will update the component before
I enable the flag.
2020-05-13 20:01:10 -07:00
Brian Vaughn
9e5b2c94e6 Add expando prop to disabledLog function (#18914)
This will enable it to be identified by Facebook infra even if the function name is mangled during DevTools build process.
2020-05-13 17:03:50 -07:00
Andrew Clark
fdb641629e Fix useMutableSource tearing bug (#18912)
* Failing useMutableSource test

If a source is mutated after initial read but before subscription is set
up, it should still entangle all pending mutations even if snapshot of
new subscription happens to match.

Test case illustrates how not doing this can lead to tearing.

* Fix useMutableSource tearing bug

Fix is to move the entanglement call outside of the block that checks
if the snapshot has changed.
2020-05-13 14:28:17 -07:00
Andrew Clark
33589f7423 useMutableSource: "Entangle" instead of expiring (#18889)
* useMutableSource: "Entangle" instead of expiring

A lane is said to be entangled with another when it's not allowed to
render in a batch that does not also include the other lane.

This commit implements entanglement for `useMutableSource`. If a source
is mutated in between when it's read in the render phase, but before
it's subscribed to in the commit phase, we must account for whether the
same source has pending mutations elsewhere. The old subscriptions must
not be allowed to re-render without also including the new subscription
(and vice versa), to prevent tearing.

In the old reconciler, we did this by synchronously flushing all the
pending subscription updates. This works, but isn't ideal. The new
reconciler can entangle the updates without de-opting to sync.

In the future, we plan to use this same mechanism for other features,
like skipping over intermediate useTransition states.

* Use clz instead of ctrz to pick an arbitrary lane

Should be slightly faster since most engines have built-in support.
2020-05-13 11:33:32 -07:00
Dan Abramov
43063fd844 eslint-plugin-react-hooks@4.0.2 2020-05-13 16:46:26 +01:00
Dan Abramov
f6ff4c43dd Update changelog 2020-05-13 16:45:50 +01:00
Boris Sergeev
487c693846 [eslint-plugin-react-hooks] useWithoutEffectSuffix fix (#18902) (#18907)
* [eslint-plugin-react-hooks] reproduce bug with a test and fix it (#18902)

Since we only reserve `-Effect` suffix, react-hooks/exhaustive-deps is
expected to succeed without warning on a custom hook which contains -Effect- in
the middle of it's name (but does NOT contain it as a suffix).

* [eslint-plugin-react-hooks] reproduced bug with a test and fix it

Since we only reserve `-Effect` suffix, react-hooks/exhaustive-deps is expected
to succeed without warning on a render helper which contains -use- in the middle
of it's name (but does NOT contain it as a prefix, since that would violate hook
naming convetion).

Co-authored-by: Boris Sergeyev <boris.sergeyev@quolab.com>
2020-05-13 16:44:05 +01:00
Dominic Gannaway
6514e4a179 React Flare: fix PressLegacy preventDefault issue (#18904) 2020-05-13 13:59:32 +01:00
Nick Reiley
a3fccd2567 Fix Profiler root change error (#18880) 2020-05-12 15:47:23 -07:00
Dominic Gannaway
61f2a560e0 Add experimental ReactDOM.createEventHandle (#18756) 2020-05-12 20:24:25 +01:00
Dan Abramov
84fd4b853f Revert "deps: update ESLint version to v7 (#18897)" (#18899)
This reverts commit 039ad34a05.
2020-05-12 20:06:14 +01:00
Dan Abramov
14e554b310 Add missing changelog item 2020-05-12 19:18:26 +01:00
Dominic Gannaway
80c4dea0d1 Modern Event System: Add scaffolding for createEventHandle (#18898) 2020-05-12 19:01:12 +01:00
Toru Kobayashi
039ad34a05 deps: update ESLint version to v7 (#18897) 2020-05-12 18:41:37 +01:00
Dan Abramov
9f396bdd5d eslint-plugin-react-hooks@4.0.1 2020-05-12 17:22:00 +01:00
Richard Maisano
c512aa0081 [Blocks] Scaffolding react-fetch + first pass at node implementation (#18863)
* First pass at scaffolding out the Node implementation of react-data.

While incomplete, this patch contains some changes to the react-data
package in order to start adding support for Node.

The first part of this change accounts for splitting react-data/fetch
into two discrete entries, adding (and defaulting to) the Node
implementation.

The second part is sketching out a rough approximation of `fetch` for
Node. This implementation is not complete by any means, but provides a
starting point.

* Remove NodeFetch module and put it directly into ReactDataFetchNode.

* Replaced react-data with react-fetch.

This patch shuffles around some of the scaffolding that was in
react-data in favor of react-fetch. It also removes the additional
"fetch" package in favor of something flatter.

* Tweak package organization

* Simplify and add a test

Co-authored-by: Dan Abramov <dan.abramov@me.com>
2020-05-12 17:21:45 +01:00
Dan Abramov
e936034eec Add item to ESLint Hooks plugin changelog 2020-05-12 17:02:37 +01:00
Michaël De Boey
c3ff21e01b feat(eslint-plugin-react-hooks): Support ESLint 7.x (#18878) 2020-05-12 17:01:28 +01:00
Andrew Clark
8b9c4d1688 Expose LegacyHidden type and disable <div hidden /> API in new fork (#18891)
* Expose LegacyHidden type

I will use this internally at Facebook to migrate away from
<div hidden />. The end goal is to migrate to the Offscreen type, but
that has different semantics. This is an incremental step.

* Disable <div hidden /> API in new fork

Migrates to the unstable_LegacyHidden type instead. The old fork does
not support the new component type, so I updated the tests to use an
indirection that picks the correct API. I will remove this once the
LegacyHidden (and/or Offscreen) type has landed in both implementations.

* Add gated warning for `<div hidden />` API

Only exists so we can detect callers in www and migrate them to the new
API. Should not visible to anyone outside React Core team.
2020-05-11 20:02:08 -07:00
Dominic Gannaway
ef0bf8e31c Revert "Hard code enableComponentStacks in www (#18869)" (#18890)
This reverts commit fd696df472.
2020-05-11 23:29:24 +01:00
Dominic Gannaway
e16703e6c7 Modern Event System: revise ancestor logic (#18886) 2020-05-11 22:09:52 +01: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
Rohith Srivathsav
ddcc69c83b Added clear message for functional component starting with lowercase (#18881) 2020-05-10 01:52:11 +01:00
Sebastian Markbåge
539527b642 Don't cut off effects at end of list if hydrating (#18872) 2020-05-08 21:26:51 -07:00
Sebastian Markbåge
fd696df472 Hard code enableComponentStacks in www (#18869)
This is now fully rolled out.
2020-05-08 18:14:54 -07:00
Andrew Clark
6edaf6f764 Detect and prevent render starvation, per lane (#18864)
* Detect and prevent render starvation, per lane

If an update is CPU-bound for longer than expected according to its
priority, we assume it's being starved by other work on the main thread.

To detect this, we keep track of the elapsed time using a fixed-size
array where each slot corresponds to a lane. What we actually store is
the event time when the lane first became CPU-bound.

Then, when receiving a new update or yielding to the main thread, we
check how long each lane has been pending. If the time exceeds a
threshold constant corresponding to its priority, we mark it as expired
to force it to synchronously finish.

We don't want to mistake time elapsed while an update is IO-bound
(waiting for data to resolve) for time when it is CPU-bound. So when a
lane suspends, we clear its associated event time from the array. When
it receives a signal to try again, either a ping or an update, we assign
a new event time to restart the clock.

* Store as expiration time, not start time

I originally stored the start time because I thought I could use this
in the future to also measure Suspense timeouts. (Event times are
currently stored on each update object for this purpose.) But that
won't work because in the case of expiration times, we reset the clock
whenever the update becomes IO-bound. So to replace the per-update
field, I'm going to have to track those on the room separately from
expiration times.
2020-05-08 12:47:51 -07:00
Nick Reiley
6207743168 [DevTools] Allow to continue dragging when leaving profiler picker (#18852)
Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-05-08 11:19:57 -07:00
Luna Ruan
df14b5bcc1 add new IDs for each each server renderer instance and prefixes to distinguish between each server render (#18576)
There is a worry that `useOpaqueIdentifier` might run out of unique IDs if running for long enough. This PR moves the unique ID counter so it's generated per server renderer object instead. For people who render different subtrees, this PR adds a prefix option to `renderToString`, `renderToStaticMarkup`, `renderToNodeStream`, and `renderToStaticNodeStream` so identifiers can be differentiated for each individual subtree.
2020-05-07 20:46:27 -07:00
Brian Vaughn
69e732ac9d Disable Profiler commit filtering (#18862)
* Disable Profiler commit filtering

We used to filter "empty" DevTools commits, but it was error prone (see #18798). A commit may appear to be empty (no actual durations) because of component filters, but filtering these empty commits causes interaction commit indices to be off by N. This not only corrupts the resulting data, but also potentially causes runtime errors.

For that matter, hiding "empty" commits might cause confusion too. A commit *did happen* even if none of the components the Profiler is showing were involved.

* Restart flaky CI
2020-05-07 17:07:20 -07:00
Brian Vaughn
fb3f0acad9 Disable Webpack setImmediate polyfill for DevTools (#18860)
* Upgrade Webpack deps to latet

* Disable Webpack setImmediate polyfill
2020-05-07 13:13:47 -07:00
Sebastian Markbåge
edf6eac8a1 Don't cut off the tail of a SuspenseList if hydrating (#18854) 2020-05-06 23:51:46 -07:00
Sebastian Markbåge
55f5cdee01 Disable setState before mount in legacy mode (#18851)
We kind of "support" this pattern in legacy mode. It's only deprecated in
Concurrent Mode.
2020-05-06 20:30:59 -07:00
Andrew Clark
47ebc90b08 Put render phase update change behind a flag (#18850)
In the new reconciler, I made a change to how render phase updates
work. (By render phase updates, I mean when a component updates
another component during its render phase. Or when a class component
updates itself during the render phase. It does not include when
a hook updates its own component during the render phase. Those have
their own semantics. So really I mean anything triggers the "`setState`
in render" warning.)

The old behavior is to give the update the same "thread" (expiration
time) as whatever is currently rendering. So if you call `setState` on a
component that happens later in the same render, it will flush during
that render. Ideally, we want to remove the special case and treat them
as if they came from an interleaved event.

Regardless, this pattern is not officially supported. This behavior is
only a fallback. The flag only exists until we can roll out the
`setState` warnning, since existing code might accidentally rely on the
current behavior.
2020-05-06 19:19:14 -07:00
Dominic Gannaway
6778c53c16 Modern Event System: fix bug in EnterLeave (#18849) 2020-05-07 00:13:13 +01:00
Brian Vaughn
7eaa1d7e33 Updated DevTools unstable_ API references (#18847) 2020-05-06 11:14:30 -07:00
Andrew Clark
a71aa803a1 [Release] Follow redirect when downloading tarball (#18845)
Adds -L option to `curl` command.

See: https://curl.haxx.se/docs/manpage.html#-L
2020-05-06 10:28:49 -07:00
Sebastian Markbåge
96f3b7d1c3 Warn if calling setState outside of render but before commit (#18838)
* Don't attempt to render the children of a dehydrated Suspense boundary

The DehydratedFragment tag doesn't exist so doing so throws.

This can happen if we schedule childExpirationTime on the boundary and
bail out.

* Warn if scheduling work on a component before it is committed
2020-05-06 09:45:35 -07:00
Dan Abramov
33c3af284c [Blocks Fixture] Remove remaining Blocks (#18840) 2020-05-06 15:53:51 +01:00
Dan Abramov
595d27bd73 [Blocks Fixture] Drop the Blocks (#18837)
* [Blocks Fixture] Add a tiny router

* Add a way to load nested entrypoint

* Only expose URL params to nested routers

* Add keys to route definitions

* [Blocks Fixture] Drop the Blocks
2020-05-06 05:17:44 +01:00
Dominic Gannaway
823dc581fe Modern Event System: fix EnterLeave plugin logic (#18830) 2020-05-05 22:10:07 +01:00
Fernando Lores
40e6029462 wrap SuspenseInstanceRetry callback so scheduler waits for it (#18805) 2020-05-05 12:47:49 -07:00
Brian Vaughn
3cde22a84e Experimental test selector API (#18607)
Adds several new experimental APIs to aid with automated testing.

Each of the methods below accepts an array of "selectors" that identifies a path (or paths) through a React tree. There are four basic selector types:

* Component: Matches Fibers with the specified React component type
* Role: Matches Host Instances matching the (explicit or implicit) accessibility role.
* Test name: Matches Host Instances with a data-testname attribute.
* Text: Matches Host Instances that directly contain the specified text.
* There is also a special lookahead selector type that enables further matching within a path (without actually including the path in the result). This selector type was inspired by the :has() CSS pseudo-class. It enables e.g. matching a <section> that contained a specific header text, then finding a like button within that <section>.

API
* findAllNodes(): Finds all Host Instances (e.g. HTMLElement) within a host subtree that match the specified selector criteria.
* getFindAllNodesFailureDescription(): Returns an error string describing the matched and unmatched portions of the selector query.
* findBoundingRects(): For all React components within a host subtree that match the specified selector criteria, return a set of bounding boxes that covers the bounds of the nearest (shallowed) Host Instances within those trees.
* observeVisibleRects(): For all React components within a host subtree that match the specified selector criteria, observe if it’s bounding rect is visible in the viewport and is not occluded.
* focusWithin(): For all React components within a host subtree that match the specified selector criteria, set focus within the first focusable Host Instance (as if you started before this component in the tree and moved focus forwards one step).
2020-05-05 10:37:46 -07:00
Dan Abramov
c13a59c7d6 Fix Blocks fixture 2020-05-05 18:14:06 +01:00
Kevin Lewis
7992ca10df eslint-plugin-react-hooks: allow OptionalMemberExpression in deps (#18819) (#18820)
* eslint-plugin-react-hooks: allow OptionalMemberExpression in deps (#18819)

* add test case for #18819

* fix test

* run prettier
2020-05-05 13:53:42 +01:00
Dominic Gannaway
e028ce2ab7 Modern Event System: ensure target ancestors are only host nodes (#18827) 2020-05-05 13:10:05 +01:00
Dan Abramov
4d124a4f67 [Blocks Fixture] Misc updates (#18811)
* [Blocks Fixture] Update navigation buttons immediately

* Add more profile links

* Minor refactor

* Add subroutes to Profile
2020-05-05 11:53:02 +01:00
Andrew Clark
fe7163e73d Add unstable prefix to experimental APIs (#18825)
We've been shipping unprefixed experimental APIs (like `createRoot` and
`useTransition`) to the Experimental release channel, with the rationale
that because these APIs do not appear in any stable release, we're free
to change or remove them later without breaking any downstream projects.

What we didn't consider is that downstream projects might be tempted to
use feature detection:

```js
const useTransition = React.useTransition || fallbackUseTransition;
```

This pattern assumes that the version of `useTransition` that exists in
the Experimental channel today has the same API contract as the final
`useTransition` API that we'll eventually ship to stable.

To discourage feature detection, I've added an `unstable_` prefix to
all of our unstable APIs.

The Facebook builds still have the unprefixed APIs, though. We will
continue to support those; if we make any breaking changes, we'll
migrate the internal callers like we usually do. To make testing easier,
I added the `unstable_`-prefixed APIs to the www builds, too. That way
our tests can always use the prefixed ones without gating on the
release channel.
2020-05-04 22:25:41 -07:00
Sebastian Markbåge
cd4a96035f Remove old CM exports (#18710) 2020-05-04 21:39:57 -07:00
Dominic Gannaway
9751935abf Modern Event System: improve dispatching queue (#18799) 2020-05-04 16:55:45 +01:00
Dan Abramov
3e13d70984 [RN] Remove debugging invariant (#18813) 2020-05-04 15:48:35 +01:00
Dan Abramov
f6fcae58e9 [Blocks] Add Shell to Fixture (#18803)
* [Blocks] Add Feed page to fixture

* Add minimal routing

* Always show post with comments
2020-05-04 01:59:55 +01:00
Dan Abramov
d830cd9984 [Blocks] Fix stale data on updates (#18810)
* [Blocks] Failing test for nested load

* Simplify the test

* Add a similar test that fails in PROD

* Copy .type when cloning work in progress
2020-05-04 01:43:51 +01:00
Sebastian Markbåge
64d4b84204 Rename Flight to Transport (#18808)
* Rename Flight to Transport

Flight is still the codename for the implementation details (like Fiber).

However, now the public package is react-transport-... which is only
intended to be used directly by integrators.

* Rename names
2020-05-03 11:33:48 -07:00
Andrew Clark
93e078ddf2 Initial Lanes implementation (#18796)
See PR #18796 for more information.

All of the changes I've made in this commit are behind the
`enableNewReconciler` flag. Merging this to master will not affect the
open source builds or the build that we ship to Facebook.

The only build that is affected is the `ReactDOMForked` build, which is
deployed to Facebook **behind an experimental flag (currently disabled
for all users)**. We will use this flag to gradually roll out the new
reconciler, and quickly roll it back if we find any problems.

Because we have those protections in place, what I'm aiming for with
this initial PR is the **smallest possible atomic change that lands
cleanly and doesn't rely on too many hacks**. The goal has not been to
get every single test or feature passing, and it definitely is not to
implement all the features that we intend to build on top of the new
model. When possible, I have chosen to preserve existing semantics and
defer changes to follow-up steps. (Listed in the section below.)

(I did not end up having to disable any tests, although if I had, that
should not have necessarily been a merge blocker.)

For example, even though one of the primary goals of this project is to
improve our model for parallel Suspense transitions, in this initial
implementation, I have chosen to keep the same core heuristics for
sequencing and flushing that existed in the ExpirationTimes model: low
priority updates cannot finish without also finishing high priority
ones.

Despite all these precautions, **because the scope of this refactor is
inherently large, I do expect we will find regressions.** The flip side
is that I also expect the new model to improve the stability of the
codebase and make it easier to fix bugs when they arise.
2020-05-02 17:09:31 -07:00
Moti Zilberman
3c7d52c3d6 Give unresolved lazy() a name in component stack (#16104)
* Give unresolved lazy() a name in component stack

* Normalize stack in tests

Co-authored-by: Sebastian Markbage <sema@fb.com>
2020-05-01 16:41:39 -07:00
Benedikt Franke
333deb707d Remove hint to post feedback about exhaustive-deps rule (#18712)
The thread is closed and locked.
2020-05-01 19:13:59 +01:00
Dominic Gannaway
aa88589d0b Refine experimental Scopes API (#18778)
* Refine experimental Scopes API
2020-05-01 19:01:43 +01:00
Dan Abramov
d804f99b9e eslint-plugin-react-hooks@4.0.0 2020-05-01 17:13:56 +01:00
Dan Abramov
4e93b9364c Add changelog for eslint-plugin-react-hooks (#18801) 2020-05-01 17:12:32 +01:00
Aaron Pettengill
5ac9ca72df Feature: Add support to exhaustive-deps rule for any hook ending with Effect (#18580)
* Add test cases for support exhaustive deps ending in Effect

* Apply the exhaustive deps lint rule to any hook ending with Effect

* Add another test for supporting linting useXEffect hooks

Co-authored-by: Aaron Pettengill <aaron.pettengill@echoman.com>
2020-05-01 16:57:25 +01:00
Dan Abramov
eab94403d7 Build Flight runtime for WWW (revert part of earlier change) 2020-05-01 16:44:25 +01:00
Sebastian Markbåge
17dcc29cd1 Don't "schedule" discrete work if we're scheduling sync work (#18797) 2020-05-01 08:43:15 -07:00
Dan Abramov
9491f39472 react-refresh@0.8.2 2020-05-01 16:18:13 +01:00
Dan Abramov
43a1c72751 Don't build react-data for WWW 2020-05-01 16:13:11 +01:00
Dan Abramov
01914a7673 Update bundle configs to not build some packages (#18800)
* Stop building old ReactCache for FB

* Update other bundle configs
2020-05-01 16:07:36 +01:00
Sophie Alpert
21670cf4be [react-refresh/babel] Always insert registrations after var (#18794)
Previously, we transformed

```
let Foo = styled.div``;
```

to

```
let Foo = _c1 = styled.div``;
```

and then babel-plugin-styled-components would infer `_c1` as the display name. Widen the existing case that applies to function expressions to apply to any type of variable declaration.
2020-05-01 16:01:11 +01:00
Andrew Clark
914b57be27 Move legacy hidden API to new internal Fiber type (#18782)
* Unhide Suspense trees without entanglement

When a Suspense boundary is in its fallback state, you cannot switch
back to the main content without also finishing any updates inside the
tree that might have been skipped. That would be a form of tearing.

Before we fixed this in #18411, the way this bug manifested was that a
boundary was suspended by an update that originated from a child
component (as opposed to props from a parent). While the fallback was
showing, it received another update, this time at high priority. React
would render the high priority update without also including the
original update. That would cause the fallback to switch back to the
main content, since the update that caused the tree to suspend was no
longer part of the render. But then, React would immediately try to
render the original update, which would again suspend and show the
fallback, leading to a momentary flicker in the UI.

The approach added in #18411 is, when receiving a high priority update
to a Suspense tree that's in its fallback state is to bail out, keep
showing the fallback and finish the update in the rest of the tree.
After that commits, render again at the original priority. Because low
priority expiration times are inclusive of higher priority expiration
times, this ensures that all the updates are committed together.

The new approach in this commit is to turn `renderExpirationTime` into a
context-like value that lives on the stack. Then, when unhiding the
Suspense boundary, we can push a new `renderExpirationTime` that is
inclusive of both the high pri update and the original update that
suspended. Then the boundary can be unblocked in a single render pass.

An advantage of the old approach is that by deferring the work of
unhiding, there's less work to do in the high priority update.

The key advantage of the new approach is that it solves the consistency
problem without having to entangle the entire root.

* Create internal LegacyHidden type

This only exists so we can clean up the internal implementation of
`<div hidden={isHidden} />`, which is not a stable feature. The goal
is to move everything to the new Offscreen type instead. However,
Offscreen has different semantics, so before we can remove the legacy
API, we have to migrate our internal usage at Facebook. So we'll need
to maintain both temporarily.

In this initial commit, I've only added the type. It's not used
anywhere. The next step is to use it to implement `hidden`.

* Use LegacyHidden to implement old hidden API

If a host component receives a `hidden` prop, we wrap its children in
an Offscreen fiber. This is similar to what we do for Suspense children.

The LegacyHidden type happens to share the same implementation as the
new Offscreen type, for now, but using separate types allows us to fork
the behavior later when we implement our planned changes to the
Offscreen API.

There are two subtle semantic changes here. One is that the children of
the host component will have their visibility toggled using the same
mechanism we use for Offscreen and Suspense: find the nearest host node
children and give them a style of `display: none`. We didn't used to do
this in the old API, because the `hidden` DOM attribute on the parent
already hides them. So with this change, we're actually "overhiding" the
children. I considered addressing this, but I figure I'll leave it as-is
in case we want to expose the LegacyHidden component type temporarily
to ease migration of Facebook's internal callers to the Offscreen type.

The other subtle semantic change is that, because of the extra fiber
that wraps around the children, this pattern will cause the children
to lose state:

```js
return isHidden ? <div hidden={true} /> : <div />;
```

The reason is that I didn't want to wrap every single host component
in an extra fiber. So I only wrap them if a `hidden` prop exists. In
the above example, that means the children are conditionally wrapped
in an extra fiber, so they don't line up during reconciliation, so
they get remounted every time `isHidden` changes.

The fix is to rewrite to:

```js
return <div hidden={isHidden} />;
```

I don't anticipate this will be a problem at Facebook, especially since
we're only supposed to use `hidden` via a userspace wrapper component.
(And since the bad pattern isn't very React-y, anyway.)

Again, the eventual goal is to delete this completely and replace it
with Offscreen.
2020-04-30 19:37:27 -07:00
Brian Vaughn
ac533fde3d Prevent stale legacy root from clearing a container (DRAFT) (#18792)
* Don't clear a container because of a stale legacy root

* Added test repro for FB error
2020-04-30 15:56:21 -07:00
Dan Abramov
5b89d353e2 Update react-refresh README 2020-04-30 15:43:21 +01:00
Dan Abramov
3a9c373521 [Blocks] Add preload to fetch (#18785) 2020-04-30 02:23:18 +01:00
Dan Abramov
dd7f0deb94 [Blocks] Use native fetch (#18784)
* [Blocks] Use native fetch

* Use the prototype

* Support arrayBuffer() and blob()

* ctor

* Simplify

* Use an expando

* Keep a map of formats

* Unused

* Remove unnecessary second property read

* Keep it simple

* Store the original thenable
2020-04-30 01:24:04 +01:00
Alex Taylor
e71f5df9c3 Consistent useCallback implementation in ReactDOMServer (#18783) 2020-04-29 16:22:10 -07:00
Dan Abramov
515326753b [Blocks] Initial implementation of cache and data/fetch (#18774)
* Rename ReactCache -> ReactCacheOld

We still use it in some tests so I'm going to leave it for now. I'll start making the new one in parallel in the react package.

* Add react/unstable-cache entry point

* Add react-data entry point

* Initial implementation of cache and data/fetch

* Address review
2020-04-29 19:14:15 +01:00
Dan Abramov
53d68b33ff [Blocks] Add Client Fixture (#18773)
* [Blocks] Add Client Fixture

* Add more TODOs
2020-04-29 02:23:09 +01:00
Dominic Gannaway
88d0be6da5 Refactor ElementListenerMap (#18766) 2020-04-28 21:53:51 +01:00
Brian Vaughn
ea2af878cc Root API should clear non-empty roots before mounting (#18730)
* Root API should clear non-empty roots before mounting

Legacy render-into-subtree API removes children from a container before rendering into it. The root API did not do this previously, but just left the children around in the document.

This commit adds a new FiberRoot flag to clear a container's contents before mounting. This is done during the commit phase, to avoid multiple, observable mutations.
2020-04-28 13:07:42 -07:00
Nick Reiley
d2ef120089 Allow Node 14.x (#18755) 2020-04-28 15:57:45 +01:00
Sebastian Markbåge
53ce0c3452 Allow flushSync to noop in life cycles but with a warning (#18759) 2020-04-27 20:07:39 -07:00
Andrew Clark
f342a2399f SuspenseList: Reschedule at same priority (#18738)
SuspenseList progressively renders items even if the list is CPU bound,
i.e. it isn't waiting for missing data. It does this by showing a
fallback for the remaining items, committing the items in that have
already finished, then starting a new render to continue working on
the rest.

When it schedules that subsequent render, it uses a slightly lower
priority than the current render: `renderExpirationTime - 1`.

This commit changes it to reschedule at `renderExpirationTime` instead.

I don't know what the original motivation was for bumping the expiration
time slightly lower. The comment says that the priorities of the two
renders are the same (which makes sense to me) so I imagine it was
motivated by some implementation detail. I don't think it's necessary
anymore, though perhaps it was when it was originally written. If it is
still necessary, we should write a test case that illustrates why.
2020-04-25 20:27:35 -07:00
Andrew Clark
cb70753993 Move hide/unhide logic to Offscreen component
The Offscreen component is not a public type, yet, but once it is, it
will share the same hide/unhide logic as Suspense children.
2020-04-25 00:10:09 -07:00
Andrew Clark
cb48f974c9 Wrap primary tree in Offscreen fiber type
Still just acts like a fragment. Next step is to move the hide/unhide
logic to the Offscreen implementation.
2020-04-25 00:10:09 -07:00
Luna Ruan
ed01fdacce Add Offscreen component type
Doesn't do anything special in this initial commit. Just acts like a
fragment.
2020-04-25 00:10:09 -07:00
Andrew Clark
1df756ba2c Always wrap Suspense children in fragment (#18711)
Changes the internal fiber structure of the Suspense component. When a
Suspense boundary can't finish rendering and switches to a fallback, we
wrap the "primary" tree in a Fragment fiber and hide all its DOM nodes.
Then we mount the fallback tree into a separate Fragment fiber. Both
trees will render into the same parent DOM node (since React fragments
aren't part of the host tree), but the wrappers ensure that the children
in each tree are reconciled separately.

The old implementation would try to be clever and only add the fragment
wrapper when the fallback was in place, to save memory. This "worked"
but was prone to regressions, since this is the only such place in the
codebase where we wrap existing nodes in a new node. (In other words,
it's a form of reparenting, which we don't implement elsewhere).

Since the original implementation, we've also added lots of additional
requirements to the Suspense component that have led to an explosion in
complexity, like limited support in Legacy Mode (with very different
semantics) and progressive hydration.

We're planning to add even more features to the Suspense boundary, so
we're going to sacrifice a bit more memory for a simpler implementation
that is less prone to regressions.

This ended up removing a lot of weird hacks and edge cases, but there
are still plenty left over. Most of the remaining complexity is related
to Legacy mode. That's the next thing we should aim to drop support for.

Because this is a risky change, I've only changed this in the new
reconciler. It blocks some other features, but as of now we're not
planning to implement those in the old reconciler. If that changes, this
should cherry-pick to the other implementation without much effort.
2020-04-25 00:09:19 -07:00
Andrew Clark
db6513914f Make ExpirationTime an opaque type (#18732)
* Add LanePriority type

React's internal scheduler has more priority levels than the external
Scheduler package. Let's use React as the source of truth for tracking
the priority of updates so we have more control. We'll still fall back
to Scheduler in the default case. In the future, we should consider
removing `runWithPriority` from Scheduler and replacing the valid use
cases with React-specific APIs.

This commit adds a new type, called a LanePriority to disambiguate from
the Scheduler one.

("Lane" refers to another type that I'm planning. It roughly translates
to "thread." Each lane will have a priority associated with it.)

I'm not actually using the lane anywhere, yet. Only setting stuff up.

* Remove expiration times train model

In the old reconciler, expiration times are computed by applying an
offset to the current system time. This has the effect of increasing
the priority of updates as time progresses. Because we also use
expiration times as a kind of "thread" identifier, it turns out this
is quite limiting because we can only flush work sequentially along
the timeline.

The new model will use a bitmask to represent parallel threads that
can be worked on in any combination and in any order.

In this commit, expiration times and the linear timeline are still in
place, but they are no longer based on a timestamp. Effectively, they
are constants based on their priority level.

* Stop using ExpirationTime to represent timestamps

Follow up to the previous commit. This converts the remaining places
where we were using the ExpirationTime type to represent a timestamp,
like Suspense timeouts.

* Fork Dependencies and PendingInteractionMap types

These contain expiration times

* Make ExpirationTime an opaque type

ExpirationTime is currently just an alias for the `number` type, for a
few reasons. One is that it predates Flow's opaque type feature. Another
is that making it opaque means we have to move all our comparisons and
number math to the ExpirationTime module, and use utility functions
everywhere else.

However, this is actually what we want in the new system, because the
Lanes type that will replace ExpirationTime is a bitmask with a
particular layout, and performing operations on it will involve more
than just number comparisions and artihmetic. I don't want this logic to
spread ad hoc around the whole codebase.

The utility functions get inlined by Closure so it doesn't matter
performance-wise.

I automated most of the changes with JSCodeshift, with only a few manual
tweaks to stuff like imports. My goal was to port the logic exactly to
prevent subtle mistakes, without trying to simplify anything in the
process. I'll likely need to audit many of these sites again when I
replace them with the new type, though, especially the ones
in ReactFiberRoot.

I added the codemods I used to the `scripts` directory. I won't merge
these to master. I'll remove them in a subsequent commit. I'm only
committing them here so they show up in the PR for future reference.

I had a lot of trouble getting Flow to pass. Somehow it was not
inferring the correct type of the constants exported from the
ExpirationTime module, despite being annotated correctly.

I tried converting them them to constructor functions — `NoWork`
becomes `NoWork()` — and that made it work. I used that to unblock me,
and fixed all the other type errors. Once there were no more type
errors, I tried converting the constructors back to constants. Started
getting errors again.

Then I added a type constraint everywhere a constant was referenced.
That fixed it. I also figured out that you only have to add a constraint
when the constant is passed to another function, even if the function is
annotated. So this indicates to me that it's probably a Flow bug. I'll
file an issue with Flow.

* Delete temporary codemods used in previous commit

I only added these to the previous commit so that I can easily run it
again when rebasing. When the stack is squashed, it will be as if they
never existed.
2020-04-24 23:26:04 -07:00
Chang Yan
4b02b66111 [ESLint] Extend isHook to recognize those under PascalCase's namespace (#18722)
* Extend Namespace to PascalCase

* Add valid case for jest.useFakeTimer

* format

* format :(

* fix nits
2020-04-24 02:50:52 +01:00
Dominic Gannaway
30cee2f4c7 Modern Event System: register onMouseEnter for portals (#18720) 2020-04-23 20:57:52 +01:00
Dominic Gannaway
4e3545fd6f ReactDOMEventListener: clean up module (#18713) 2020-04-23 20:19:28 +01:00
Sebastian Markbåge
b58dec979a Remove unnecessary stack (#18707) 2020-04-23 09:44:37 -07:00
Sebastian Markbåge
a2fb84bebd Disable prepareStackTrace while we're generating stacks (#18708)
This could be used to do custom formatting of the stack trace in a way
that isn't compatible with how we use it. So we disable it while we use
it.

In theory we could call this ourselves with the result of our stack.
It would be a lot of extra production code though. My personal opinion
is that this should always be done server side instead of on the client.

We could expose a custom parser that converts it and passes it through
prepareStackTrace as structured data. That way it's external and doesn't
have to be built-in to React.
2020-04-23 09:16:58 -07:00
Brian Vaughn
b9fc3d8d59 DevTools temporarily disable prepareStackTrace before creating custom component stacks (#18717) 2020-04-23 09:02:42 -07:00
Sebastian Markbåge
b0cb137bcb Don't dedupe using the stack (#18693)
We currently use the stack to dedupe warnings in a couple of places.
This is a very heavy weight way of computing that a warning doesn't need
to be fired.

This uses parent component name as a heuristic for deduping. It's not
perfect but as soon as you fix one you'll uncover the next. It might be a
little annoying but having many logs is also annoying.

We now have no special cases for stacks. The only thing that uses stacks in
dev is the console.error and dev tools. This means that we could
externalize this completely to an console.error patching module and drop
it from being built-in to react.

The only prod/dev behavior is the one we pass to error boundaries or the
error we throw if you don't have an error boundary.
2020-04-22 19:02:11 -07:00
Sebastian Markbåge
571f5ad2d6 Temporarily Remove DebugTracing from the New Reconciler (#18697)
* Remove priority field from tracing

* Remove DebugTracing mode from new reconciler (temporarily)

* Run DebugTracing tests in the *other* variant so it's no on for new reconciler
2020-04-21 20:14:40 -07:00
Sebastian Markbåge
2325375f4f Nit: add suffix _TIMEOUT consistently in scheduler (#18696) 2020-04-21 19:44:42 -07:00
Nick Reiley
e5cc1462b3 Fix mistyped script arbitrary code execution vulnerability (#18660)
* add test to trustedTypes-test.internal.js

* fix mistyped script arbitrary code execution

* Removed redundant .toLowerCase() call

Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-04-21 12:10:25 -07:00
Brian Vaughn
9025949d84 Pin RNW to canary (#18692)
This unbreaks DevTools shell with the latest ReactDOM in master.
2020-04-21 11:46:29 -07:00
Brian Vaughn
36cab2720a DevTools: Improved "native" component stacks (#18656)
* DevTools console override handles new component stack format

DevTools does not attempt to mimic the default browser console format for its component stacks but it does properly detect the new format for Chrome, Firefox, and Safari.
2020-04-21 11:46:11 -07:00
Sebastian Markbåge
940f48b999 Avoid passing custom stacks to console.error (#18685)
* Detect double stacks in the new format in tests

* Remove unnecessary uses of getStackByFiberInDevAndProd

These all execute in the right execution context already.

* Set the debug fiber around the cases that don't have an execution context

* Remove stack detection in our console log overrides

We never pass custom stacks as part of the args anymore.

* Bonus: Don't append getStackAddendum to invariants

We print component stacks for every error anyway so this is just duplicate
information.
2020-04-21 09:22:46 -07:00
Dominic Gannaway
ff431b7fc4 Remove ReactDOM.useEvent and associated types+tests (#18689) 2020-04-21 16:40:44 +01:00
Dominic Gannaway
7b3934b34f Revert "Pressable click fix (#18625)" (#18688)
This reverts commit 5f7b175b35.
2020-04-21 11:08:30 +01:00
Dominic Gannaway
80d39d8b57 Remove null sibling (#18687) 2020-04-21 10:43:50 +01:00
Sebastian Markbåge
0960b7ba58 Upgrade fbjs-scripts (#18684)
* Upgrade fbjs-scripts

This script takes into account the NODE_ENV as part of jest cache keys.
This avoids flaky tests since we depend on different transforms in prod
and dev.

* Upgrade Fresh test to Babel 7 transform
2020-04-20 18:20:03 -07:00
Naman Goel
5f7b175b35 Pressable click fix (#18625)
* Update press-legacy to use native click events

* update tests for pressable change

* fix formatting issue

* Address comments. Bring back some tests, remove others. Cleanup

* Fix flow and lint errors

* formatting fix missed by yarn lint
2020-04-20 23:13:17 +01:00
Dominic Gannaway
4f59a149b8 Modern event system: fix selectionchange bug (#18680) 2020-04-20 19:54:12 +01:00
Dominic Gannaway
a152827ef6 Refine the heuristics around beforeblur/afterblur (#18668)
* Refine the heuristics around beforeblur/afterblur
2020-04-20 19:32:22 +01:00
Sebastian Silbermann
707478e68a chore: Build react-dom/server in codesandbox CI (#18679) 2020-04-20 18:48:07 +01:00
Sebastian Silbermann
ffb6c6c07b fix: skip dangerouslySetInnerHtml hydration warning if it's undefined (#18676)
* test: Add failing case for dangerouslySetInnerHtml=undefined

* fix: skip dangerouslySetInnerHtml warning if it's undefined

* test: add similar test that should trigger the warning

* chore: Remove redundant nullish check

* Poke yarn_test_www_variant which timed out

* test: Add smaller test for innerHTML=string to innerHTML=undefined
2020-04-20 18:46:55 +01:00
Dominic Gannaway
1078029af6 Revert "Revert focus event PRs (#18655)" (#18671)
This reverts commit 58c895e59c.
2020-04-20 16:00:33 +01:00
Nicolas Gallagher
96203240d3 ReactDOM: remove unstable-native-dependencies bundle (#18483)
This is only used by react-native-web and will be replaced by a user-space
implementation. See: https://github.com/necolas/react-native-web/issues/1568
2020-04-18 15:40:13 -07:00
Brian Vaughn
263bc5d54b Fix incorrect unmounted state update warning (#18617)
* Fix incorrect unmounted state update warning

We detach fibers (which nulls the  field) when we commit a deletion, so any state updates scheduled between that point and when we eventually flush passive effect destroys won't have a way to check if there is a pending passive unmount effect scheduled for its alternate unless we also explicitly track this for both the current and the alternate.

This commit adds a new DEV-only effect type, `PendingPassiveUnmountDev`, to handle this case.
2020-04-18 12:18:19 -07:00
Andrew Clark
52a0d6b5ab Make Flow work with your editor (#18664)
We typecheck the reconciler against each one of our host configs.
`yarn flow dom` checks it against the DOM renderer, `yarn flow native`
checks it against the native renderer, and so on.

To do this, we generate separate flowconfig files.

Currently, there is no root-level host config, so running Flow
directly via `flow` CLI doesn't work. You have to use the `yarn flow`
command and pick a specific renderer.

A drawback of this design, though, is that our Flow setup doesn't work
with other tooling. Namely, editor integrations.

I think the intent of this was maybe so you don't run Flow against a
renderer than you intended, see it pass, and wrongly think you fixed
all the errors. However, since they all run in CI, I don't think this
is a big deal. In practice, I nearly always run Flow against the same
renderer (DOM), and I'm guessing that's the most common workflow for
others, too.

So what I've done in this commit is modify the `yarn flow` command to
copy the generated `.flowconfig` file into the root directory. The
editor integration will pick this up and show Flow information for
whatever was the last renderer you checked.

Everything else about the setup is the same, and all the renderers will
continue to be checked by CI.
2020-04-18 10:24:46 -07:00
Andrew Clark
cfefc81ab2 Fix for #18657 (#18663)
* Failing test for #18657

* Remove incorrect priority check

I think this was just poor factoring on my part in #18411. Honestly it
doesn't make much sense to me, but my best guess is that I must have
thought that when `baseTime > currentChildExpirationTime`, the function
would fall through to the
`currentChildExpirationTime < renderExpirationTime` branch below.

Really I think just made an oopsie.

Regardless, this logic is galaxy brainéd. A goal of the Lanes refactor
I'm working on is to make these types of checks -- is there remaining
work in this tree? -- a lot easier to think about. Hopefully.
2020-04-17 16:32:55 -07:00
Dominic Gannaway
e7163a9c2f Revise isFiberInsideHiddenOrRemovedTree (#18662) 2020-04-17 23:58:40 +01:00
Andrew Clark
a4b1e65afc Remove redundant expiration time comparisons (#18620)
I'm going through all the expiration times comparisons as part of my
refactor and I noticed this one has a redundancy.
2020-04-17 11:48:05 -07:00
Dominic Gannaway
58c895e59c Revert focus event PRs (#18655)
* Revert "Further cleanup to before/after blur (#18649)"

This reverts commit e2ccbf0358.

* Revert "Unify Flare FocusWithin responder with useFocusWithin (#18636)"

This reverts commit f24a9e7098.
2020-04-17 16:27:19 +01:00
Dominic Gannaway
e2ccbf0358 Further cleanup to before/after blur (#18649) 2020-04-17 11:52:29 +01:00
Brian Vaughn
c5c25d35a3 Fixed DevTools extension build:dev command (#18648) 2020-04-16 17:39:16 -07:00
dependabot[bot]
f8b084276d Bump https-proxy-agent from 2.2.1 to 2.2.4 in /scripts/release (#18642)
Bumps [https-proxy-agent](https://github.com/TooTallNate/node-https-proxy-agent) from 2.2.1 to 2.2.4.
- [Release notes](https://github.com/TooTallNate/node-https-proxy-agent/releases)
- [Commits](https://github.com/TooTallNate/node-https-proxy-agent/compare/2.2.1...2.2.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-04-16 16:06:13 -07:00
dependabot[bot]
0f9b30f7b5 Bump https-proxy-agent from 2.2.2 to 2.2.4 (#18643)
Bumps [https-proxy-agent](https://github.com/TooTallNate/node-https-proxy-agent) from 2.2.2 to 2.2.4.
- [Release notes](https://github.com/TooTallNate/node-https-proxy-agent/releases)
- [Commits](https://github.com/TooTallNate/node-https-proxy-agent/compare/2.2.2...2.2.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-04-16 16:06:06 -07:00
Dominic Gannaway
32bb44c80a Clean up modern plugins to remove dead code (#18639) 2020-04-16 20:10:23 +01:00
Dan Abramov
0301f3e24f Statically disable factory components for WWW (#18641) 2020-04-16 19:42:30 +01:00
Dominic Gannaway
f24a9e7098 Unify Flare FocusWithin responder with useFocusWithin (#18636) 2020-04-16 19:35:41 +01:00
Dominic Gannaway
b1a083183c Revert legacy plugin modules (#18638) 2020-04-16 18:46:24 +01:00
Dominic Gannaway
31977d1bb3 Create copy of Legacy event plugins for Modern system (#18637) 2020-04-16 16:09:05 +01:00
Andrew Clark
c12c2c4c8c Run error replay test again new reconciler (#18628)
This is one of our few tests of an internal function. Need to import
the module that corresponds to the reconciler that's being tested.
2020-04-16 08:08:22 -07:00
Boris Serdiuk
7b4403cecd Fix requiring timers module with non standard require (#18632)
fixes #18589
2020-04-16 12:36:09 +01:00
Thomas Brown
5f6b75dd26 ADD: disableRemotePlayback attribute for HTML5 videos (#18619)
* Add support for disableremoteplayback

* Order attributes alphabetically

Co-authored-by: Tom Brown <Thomas.Brown-CIC-UK@ibm.com>
2020-04-16 10:23:48 +01:00
Brian Vaughn
71964c0346 Fix CI (#18626) 2020-04-15 22:27:24 -07:00
Andrew Clark
50b9f154c1 Fix wrong command in config.yml (#18624) 2020-04-15 21:44:38 -07:00
Brian Vaughn
22dc2e42bd Add experimental DebugTracing logger for internal use (#18531) 2020-04-15 19:10:15 -07:00
Andrew Clark
dbd2626855 Update nvmrc to the same one used in CI (#18623) 2020-04-15 16:03:02 -07:00
Andrew Clark
b680174841 Delete mutableSourceFirstPendingUpdateTime (#18613) 2020-04-15 07:47:37 -07:00
Andrew Clark
cbafbf4f32 Fix typo in TestFlags
Copypasta when setting up `old` and `new` aliases. `old` should mean
that `enableNewReconciler` is off.
2020-04-14 23:32:53 -07:00
Dominic Gannaway
d53988a9d1 ReactDOM.useEvent: add useEvent interaction hook (#18604) 2020-04-14 22:06:46 +01:00
Dominic Gannaway
bf55ea7434 Move beforeblur phase to prepareForCommit (#18609) 2020-04-14 21:30:54 +01:00
Andrew Clark
843b50cbe1 Remove .internal from more test suites (#18597) 2020-04-14 07:43:00 -07:00
BetaSu
1d7bd52688 remove unnecessary variable comparation (#18598)
Since it will continue when the props are equal in line 767, there is no need to compare whether they are not equal.
2020-04-14 14:53:47 +01:00
Andrew Clark
b928fc030a Delete flushSuspenseFallbacksInTests flag (#18596)
* Move renderer `act` to work loop

* Delete `flushSuspenseFallbacksInTests`

This was meant to be a temporary hack to unblock the `act` work, but it
quickly spread throughout our tests.

What it's meant to do is force fallbacks to flush inside `act` even in
Concurrent Mode. It does this by wrapping the `setTimeout` call in a
check to see if it's in an `act` context. If so, it skips the delay and
immediately commits the fallback.

Really this is only meant for our internal React tests that need to
incrementally render. Nobody outside our team (and Relay) needs to do
that, yet. Even if/when we do support that, it may or may not be with
the same `flushAndYield` pattern we use internally.

However, even for our internal purposes, the behavior isn't right
because a really common reason we flush work incrementally is to make
assertions on the "suspended" state, before the fallback has committed.
There's no way to do that from inside `act` with the behavior of this
flag, because it causes the fallback to immediately commit. This has led
us to *not* use `act` in a lot of our tests, or to write code that
doesn't match what would actually happen in a real environment.

What we really want is for the fallbacks to be flushed at the *end` of
the `act` scope. Not within it.

This only affects the noop and test renderer versions of `act`, which
are implemented inside the reconciler. Whereas `ReactTestUtils.act` is
implemented in "userspace" for backwards compatibility. This is fine
because we didn't have any DOM Suspense tests that relied on this flag;
they all use test renderer or noop.

In the future, we'll probably want to move always use the reconciler
implementation of `act`. It will not affect the prod bundle, because we
currently only plan to support `act` in dev. Though we still haven't
completely figured that out. However, regardless of whether we support a
production `act` for users, we'll still need to write internal React
tests in production mode. For that use case, we'll likely add our own
internal version of `act` that assumes a mock Scheduler and might rely
on hacks that don't 100% align up with the public one.
2020-04-13 20:02:18 -07:00
Andrew Clark
f3f3d77c20 Fix www tests not running in prod (#18593)
I made a mistake when setting these up a while ago. Setting the NODE_ENV
in the CircleCI config doesn't work because it's also set in the node
script command.

The number of test commands is getting out of control. Might need to fix
it at some point. Not today for me.
2020-04-13 15:53:13 -07:00
Andrew Clark
bec7599067 Migrate conditional tests to gate pragma (#18585)
* Migrate conditional tests to gate pragma

I searched through the codebase for this pattern:

```js
describe('test suite', () => {
  if (!__EXPERIMENTAL__) { // or some other condition
    test("empty test so Jest doesn't complain", () => {});
    return;
  }

  // Unless we're in experimental mode, none of the tests in this block
  // will run.
})
```

and converted them to the `@gate` pragma instead.

The reason this pattern isn't preferred is because you end up disabling
more tests than you need to.

* Add flag for www release channels

Using a heuristic where I check a flag that is known to only be enabled
in www. I left a TODO to instead set the release channel explicitly in
each test config.
2020-04-13 14:45:52 -07:00
Chris Dobson
6c43a62c0f DevTools: Switch between "Rendered At" renders using keyboard arrow keys (#18586)
* Add keyboard navigation to fibre info sidebar

Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-04-13 13:00:13 -07:00
Andrew Clark
0c3c27a718 Fix "missing flag" error for non-boolean types (#18592)
Not all test flags are booleans, e.g. the build type
2020-04-13 12:57:31 -07:00
Andrew Clark
65237a237e Codemod it.experimental to gate pragma (#18582)
* Codemod it.experimental to gate pragma

Find-and-replace followed by Prettier

* Delete it.experimental

Removes the API from our test setup script
2020-04-13 10:28:59 -07:00
Andrew Clark
42d7c2e8f7 Add pragma for feature testing: @gate (#18581)
* Add pragma for feature testing: @gate

The `@gate` pragma declares under which conditions a test is expected to
pass.

If the gate condition passes, then the test runs normally (same as if
there were no pragma).

If the conditional fails, then the test runs and is *expected to fail*.

An alternative to `it.experimental` and similar proposals.

Examples
--------

Basic:

```js
// @gate enableBlocksAPI
test('passes only if Blocks API is available', () => {/*...*/})
```

Negation:

```js
// @gate !disableLegacyContext
test('depends on a deprecated feature', () => {/*...*/})
```

Multiple flags:

```js
// @gate enableNewReconciler
// @gate experimental
test('needs both useEvent and Blocks', () => {/*...*/})
```

Logical operators (yes, I'm sorry):

```js
// @gate experimental && (enableNewReconciler || disableSchedulerTimeoutBasedOnReactExpirationTime)
test('concurrent mode, doesn\'t work in old fork unless Scheduler timeout flag is disabled', () => {/*...*/})
```

Strings, and comparion operators

No use case yet but I figure eventually we'd use this to gate on
different release channels:

```js
// @gate channel ===  "experimental" || channel === "modern"
test('works in OSS experimental or www modern', () => {/*...*/})
```

How does it work?

I'm guessing those last two examples might be controversial. Supporting
those cases did require implementing a mini-parser.

The output of the transform is very straightforward, though.

Input:
```js
// @gate a && (b || c)
test('some test', () => {/*...*/})
```

Output:

```js
_test_gate(ctx => ctx.a && (ctx.b || ctx.c, 'some test'), () => {/*...*/});
```

It also works  with `it`, `it.only`, and `fit`. It leaves `it.skip` and
`xit` alone because those tests are disabled anyway.

`_test_gate` is a global method that I set up in our Jest config. It
works about the same as the existing `it.experimental` helper.

The context (`ctx`) argument is whatever we want it to be. I set it up
so that it throws if you try to access a flag that doesn't exist. I also
added some shortcuts for common gating conditions, like `old`
and `new`:

```js
// @gate experimental
test('experimental feature', () => {/*...*/})

// @gate new
test('only passes in new reconciler', () => {/*...*/})
```

Why implement this as a pragma instead of a runtime API?

- Doesn't require monkey patching built-in Jest methods. Instead it
  compiles to a runtime function that composes Jest's API.
- Will be easy to upgrade if Jest ever overhauls their API or we switch
  to a different testing framework (unlikely but who knows).
- It feels lightweight so hopefully people won't feel gross using it.
  For example, adding or removing a gate pragma will never affect the
  indentation of the test, unlike if you wrapped the test in a
  conditional block.

* Compatibility with console error/warning tracking

We patch console.error and console.warning to track unexpected calls
in our tests. If there's an unexpected call, we usually throw inside
an `afterEach` hook. However, that's too late for tests that we
expect to fail, because our `_test_gate` runtime can't capture the
error. So I also check for unexpected calls inside `_test_gate`.

* Move test flags to dedicated file

Added some instructions for how the flags are set up and how to
use them.

* Add dynamic version of gate API

Receives same flags as the pragma.

If we ever decide to revert the pragma, we can codemod them to use
this instead.
2020-04-13 10:14:34 -07:00
Sebastian Markbåge
72d00ab623 Fix Component Stacks for IE and Native Classes in Safari (#18575)
* Add more edge cases to fixture

Also adjust some expectations. I think the column should ideally be 1 but varies.
The Example row is one line off because it throws on the hook but should ideally be the component.
Similarly class components with constructors may have the line in the constructor.

* Account for the construct call taking a stack frame

We do this by first searching for the first different frame, then find
the same frames and then find the first different frame again.

* Throw controls

Otherwise they don't get a stack frame associated with them in IE.

* Protect against generating stacks failing

Errors while generating stacks will bubble to the root. Since this technique
is a bit sketchy, we should probably protect against it.

* Don't construct the thing that throws

Instead, we pass the prototype as the "this". It's new every time anyway.
2020-04-10 19:39:02 -07:00
Sebastian Markbåge
98d410f500 Build Component Stacks from Native Stack Frames (#18561)
* Implement component stack extraction hack

* Normalize errors in tests

This drops the requirement to include owner to pass the test.

* Special case tests

* Add destructuring to force toObject which throws before the side-effects

This ensures that we don't double call yieldValue or advanceTime in tests.

Ideally we could use empty destructuring but ES lint doesn't like it.

* Cache the result in DEV

In DEV it's somewhat likely that we'll see many logs that add component
stacks. This could be slow so we cache the results of previous components.

* Fixture

* Add Reflect to lint

* Log if out of range.

* Fix special case when the function call throws in V8

In V8 we need to ignore the first line. Normally we would never get there
because the stacks would differ before that, but the stacks are the same if
we end up throwing at the same place as the control.
2020-04-10 13:32:12 -07:00
Brian Vaughn
8e13f099ab Overhauled release scripts and docs (#18569)
* Overhauled release scripts and docs
2020-04-10 12:28:40 -07:00
Andrew Clark
af1b039bdd ESLint rule to forbid cross fork imports (#18568)
Modules that belong to one fork should not import modules that belong to
the other fork.

Helps make sure you correctly update imports when syncing changes across
implementations.

Also could help protect against code size regressions that might happen
if one of the forks accidentally depends on two copies of the same
module.
2020-04-09 18:11:34 -07:00
Sebastian Markbåge
50bdd75a60 Bubble errors if processing the error itself errors (#18567)
If we've tried completing an incomplete boundary once and failed, we don't
need to try again.
2020-04-09 17:40:11 -07:00
Sebastian Markbåge
348ed0e93f Don't return from perform/completeUnitOfWork (#18566)
* Remove unnecessary workInProgress line

* Mutate workInProgress instead of returning

We were ambivalent about this before.

* Make handleError a void method too
2020-04-09 17:12:04 -07:00
Andrew Clark
b04c7fa28c Decouple expiration times and transition timeouts (#17920)
We currently use the expiration time to represent the timeout of a
transition. Since we intend to stop treating work priority as a
timeline, we can no longer use this trick.

In this commit, I've changed it to store the event time on the update
object instead. Long term, we will store event time on the root as a map
of transition -> event time. I'm only storing it on the update object
as a temporary workaround to unblock the rest of the changes.
2020-04-09 15:09:36 -07:00
Andrew Clark
dc630d3374 Fork ReactFiberExpirationTime
I had thought I wouldn't fork this one because the new "lanes" module
will be pretty different, but I need it to make some
incremental changes.
2020-04-09 15:09:34 -07:00
Dan Abramov
e5d06e34b6 Revert "Clear more Fiber fields in detachFiber (#18556)" (#18562)
This reverts commit d48dbb8249.
2020-04-09 20:45:02 +01:00
Sebastian Markbåge
cbab25bb51 Exclude forwardRef and memo from stack frames (#18559)
We can't patch the row. We could give these their own "built-in" stack
frame since they're conceptually HoCs. However, from a debugging
perspective this is not very useful meta data and quite noisy. So I'm
just going to exclude them.
2020-04-09 11:42:22 -07:00
Andrew Clark
26fc16484e Script for syncing changes between forks (#18550)
Adds command `yarn merge-fork`.

```sh
yarn merge-fork --base-dir=packages/react-reconciler/src ReactFiberWorkLoop
```

This will take all the changes in `ReactFiberWorkLoop.new.js` and apply
them to `ReactFiberWorkLoop.old.js`.

You can merge multiple modules at a time:

```sh
yarn merge-fork \
  --base-dir=packages/react-reconciler/src \
  ReactFiberWorkLoop \
  ReactFiberBeginWork \
  ReactFiberCompleteWork \
  ReactFiberCommitWork
```

You can provide explicit "old" and "new" file names. This only works
for one module at a time:

```sh
yarn merge-fork \
  --base-dir=packages/react-reconciler/src \
  --old=ReactFiberExpirationTime.js \
  --new=ReactFiberLane.js
```

The default is to merge changes from the new module to the old one. To
merge changes in the opposite direction, use `--reverse`.

```sh
yarn merge-fork \
  --reverse \
  --base-dir=packages/react-reconciler/src \
  ReactFiberWorkLoop
```

By default, the changes are compared to HEAD. You can use `--base-ref`
to compare to any rev. For example, while working on a PR, you might
make multiple commits to the new fork before you're ready to backport
them to the old one. In that case, you want to compare to the merge
base of your PR branch:

```sh
yarn merge-fork \
  --base-ref=$(git merge-base HEAD origin/master)
  --base-dir=packages/react-reconciler/src \
  ReactFiberWorkLoop
```
2020-04-09 11:37:13 -07:00
Sebastian Markbåge
11ac10b44e Port error boundaries test to yieldValue (#18558) 2020-04-09 11:13:01 -07:00
Dominic Gannaway
d48dbb8249 Clear more Fiber fields in detachFiber (#18556) 2020-04-09 18:31:34 +01:00
Dominic Gannaway
0566b706ee Fix fiber memory leak with runAllPassiveEffectDestroysBeforeCreates (#18554) 2020-04-09 15:35:07 +01:00
Dominic Gannaway
ca1a703d21 Make enableLegacyFBSupport flag dynamic for www (#18551) 2020-04-09 15:31:36 +01:00
Dominic Gannaway
8cbce05be1 Move plugins into their own directory (#18553) 2020-04-09 14:18:33 +01:00
Dan Abramov
c74f0b0646 Update stale.yml 2020-04-09 13:36:11 +01:00
Andrew Clark
4c6470cb3b Point ReactDOMForked to the new implementation
Updates Rollup, Jest, and Flow configuration to point to the new
entry points.
2020-04-09 00:03:35 -07:00
Andrew Clark
17f582e045 Add forked copies of reconciler modules
All changes in this commit were generated by the following commands.

Copy each module that ends with `.old` to a new file that ends
with `.new`:

```sh
for f in packages/react-reconciler/src/*.old.js; do cp "$f" "$(echo "$f" | sed s/\.old/\.new/)"; done
```

Then transform the internal imports:

```sh
grep -rl --include="*.new.js" '.old' packages/react-reconciler/src/| xargs sed -i '' "s/\.old\'/\.new\'/g"
```
2020-04-09 00:03:35 -07:00
Andrew Clark
376d5c1b5a Split cross-package types from implementation
Some of our internal reconciler types have leaked into other packages.
Usually, these types are treated as opaque; we don't read and write
to its fields. This is good.

However, the type is often passed back to a reconciler method. For
example, React DOM creates a FiberRoot with `createContainer`, then
passes that root to `updateContainer`. It doesn't do anything with the
root except pass it through, but because `updateContainer` expects a
full FiberRoot, React DOM is still coupled to all its fields.

I don't know if there's an idiomatic way to handle this in Flow. Opaque
types are simlar, but those only work within a single file. AFAIK,
there's no way to use a package as the boundary for opaqueness.

The immediate problem this presents is that the reconciler refactor will
involve changes to our internal data structures. I don't want to have to
fork every single package that happens to pass through a Fiber or
FiberRoot, or access any one of its fields. So my current plan is to
share the same Flow type across both forks. The shared type will be a
superset of each implementation's type, e.g. Fiber will have both an
`expirationTime` field and a `lanes` field. The implementations will
diverge, but not the types.

To do this, I lifted the type definitions into a separate module.
2020-04-08 23:49:23 -07:00
Andrew Clark
d686f3f16a Add .old prefix to reconciler modules 2020-04-08 23:49:19 -07:00
Sebastian Markbåge
147bdef11b Port more tests to the Scheduler.unstable_yieldValue pattern and drop internal.js (#18549)
* Drop the .internal.js suffix on some files that don't need it anymore

* Port some ops patterns to scheduler yield

* Fix triangle test to avoid side-effects in constructor

* Move replaying of setState updaters until after the effect

Otherwise any warnings get silenced if they're deduped.

* Drop .internal.js in more files

* Don't check propTypes on a simple memo component unless it's lazy

Comparing the elementType doesn't work for this because it will never be
the same for a simple element.

This caused us to double validate these. This was covered up because in
internal tests this was deduped since they shared the prop types cache
but since we now inline it, it doesn't get deduped.
2020-04-08 20:54:54 -07:00
Sebastian Markbåge
b014e2d5e3 Don't use closures in DevTools injection (#18278)
* Don't use closures in DevTools injection

Nested closures are tricky. They're not super efficient and when they share
scope between multiple closures they're hard for a compiler to optimize.
It's also unclear how many versions will be created.

By hoisting things out an just make it simple calls the compiler can do
a much better job.

* Store injected hook to work around fast refresh
2020-04-08 17:57:17 -07:00
Sebastian Markbåge
5474a83e25 Disable console.logs in the second render pass of DEV mode double render (#18547)
* Disable console log during the second rerender

* Use the disabled log to avoid double yielding values in scheduler mock

* Reenable debugRenderPhaseSideEffectsForStrictMode in tests that can
2020-04-08 16:43:51 -07:00
Dan Abramov
b225d4f261 Revert "Revert "Refactor commitPlacement to recursively insert nodes (#17996)" (#18517)" (#18540)
This reverts commit e69ca310ea.
2020-04-08 11:22:02 +01:00
jddxf
241103a6fb Fix bailout broken in lazy components due to default props resolving (#18539)
* Add failing tests for lazy components

* Fix bailout broken in lazy components due to default props resolving

We should never compare unresolved props with resolved props. Since comparing
resolved props by reference doesn't make sense, we use unresolved props in that
case. Otherwise, resolved props are used.

* Avoid reassigning props warning when we bailout
2020-04-08 10:58:57 +01:00
Andrew Clark
2dddd1e00c Bugfix: Render phase update causes remaining updates in same component to be dropped (#18537)
* Bugfix: Render phase update leads to dropped work

Render phase updates should not affect the `fiber.expirationTime` field.
We don't have to set anything on the fiber because we're going to
process the render phase update immediately.

We also shouldn't reset the `expirationTime` field in between render
passes because it represents the remaining work left in the update
queues. During the re-render, the updates that were skipped in the
original pass are not processed again.

I think my original motivation for using this field for render phase
updates was so I didn't have to add another module level variable.

* Add repro case for #18486

Co-authored-by: Dan Abramov <dan.abramov@me.com>
2020-04-07 19:17:01 -07:00
Andrew Clark
2def7b3caf More robust fix for #18515 (#18535)
* Add another test for #18515 using pings

Adds a regression test for the same underlying bug as #18515 but using
pings.

Test already passes, but I confirmed it fails if you revert the fix
in #18515.

* Set nextPendingLevel after commit, too
2020-04-07 18:52:31 -07:00
Dominic Gannaway
948fad357b Improve detachFiber (#18536) 2020-04-08 01:45:23 +01:00
Carl Vitullo
03de849af0 Make uncontrolled -> controlled warning clearer (#17070)
* Make uncontrolled -> controlled warning clearer

* Update phrasing, mirror for opposite direction

* Remove unused substitution

* Update warning tests

* Literally got these backwards, womp womp

* Rerere-fix tests
2020-04-07 23:19:56 +01:00
jddxf
ddc4b65cfe Clear finished discrete updates during commit phase (#18515)
* Reproduce a bug where `flushDiscreteUpdates` causes fallback never to be committed

* Ping suspended level when canceling its timer

Make sure the suspended level is marked as pinged so that we return back
to it later, in case the render we're about to start gets aborted.
Generally we only reach this path via a ping, but we shouldn't assume
that will always be the case.

* Clear finished discrete updates during commit phase

If a root is finished at a priority lower than that of the latest pending discrete
updates on it, these updates must have been finished so we can clear them now.
Otherwise, a later call of `flushDiscreteUpdates` would start a new empty render
pass which may cause a scheduled timeout to be cancelled.

* Add TODO

Happened to find this while writing a test. A JSX element comparison
failed because one of them elements had a functional component as an
owner, which should ever happen.

I'll add a regression test later.

Co-authored-by: Andrew Clark <git@andrewclark.io>
2020-04-07 13:34:41 -07:00
Dominic Gannaway
d53a4dbbc2 Export unstable_useEvent for www FB ReactDOM builds (#18532) 2020-04-07 21:32:38 +01:00
Brian Vaughn
8edcd03b64 DevTools Profiler: Fix "cannot read property 'memoizedState' of null" (#18522) 2020-04-07 10:30:25 -07:00
Brian Vaughn
e8ac48f90b Fix whitespace problem wiht DevTools Components search (#18527) 2020-04-07 10:28:21 -07:00
Brian Vaughn
dc49ea108c Filter certain DOM attributes (e.g. src) if value is empty string (#18513)
* Filter certain DOM attributes (e.g. src, href) if their values are empty strings

This prevents e.g. <img src=""> from making an unnecessar HTTP request for certain browsers.

* Expanded warning recommendation

* Improved error message

* Further refined error message
2020-04-07 09:52:36 -07:00
Dan Abramov
bce982b799 Change stalebot messages (#18524) 2020-04-07 17:30:45 +01:00
Brian Vaughn
32621a354f Improved Profiler tooltip confusing/misleading wording (#18523) 2020-04-07 09:26:50 -07:00
Dan Abramov
e69ca310ea Revert "Refactor commitPlacement to recursively insert nodes (#17996)" (#18517)
This reverts commit df5faddcc2.
2020-04-07 13:41:51 +01:00
Luna Ruan
3278d24218 Add useOpaqueIdentifier Hook (#17322)
* Add useOpaqueIdentifier Hook

We currently use unique IDs in a lot of places. Examples are:
  * `<label for="ID">`
  * `aria-labelledby`

This can cause some issues:
  1. If we server side render and then hydrate, this could cause an
     hydration ID mismatch
  2. If we server side render one part of the page and client side
     render another part of the page, the ID for one part could be
     different than the ID for another part even though they are
     supposed to be the same
  3. If we conditionally render something with an ID ,  this might also
     cause an ID mismatch because the ID will be different on other
     parts of the page

This PR creates a new hook `useUniqueId` that generates a different
unique ID based on whether the hook was called on the server or client.
If the hook is called during hydration, it generates an opaque object
that will rerender the hook so that the IDs match.

Co-authored-by: Andrew Clark <git@andrewclark.io>
2020-04-06 17:17:27 -07:00
Sebastian Markbåge
4169420198 Refactor Component Stack Traces (#18495)
* Add feature flag

* Split stack from current fiber

You can get stack from any fiber, not just current.

* Refactor description of component frames

These should use fiber tags for switching. This also puts the relevant code
behind DEV flags.

* We no longer expose StrictMode in component stacks

They're not super useful and will go away later anyway.

* Update tests

Context is no longer part of SSR stacks. This was already the case on the
client.

forwardRef no longer is wrapped on the stack. It's still in getComponentName
but it's probably just noise in stacks. Eventually we'll remove the wrapper
so it'll go away anyway. If we use native stack frames they won't have this
extra wrapper.

It also doesn't pick up displayName from the outer wrapper. We could maybe
transfer it but this will also be fixed by removing the wrapper.

* Forward displayName onto the inner function for forwardRef and memo in DEV

This allows them to show up in stack traces.

I'm not doing this for lazy because lazy is supposed to be called on the
consuming side so you shouldn't assign it a name on that end. Especially
not one that mutates the inner.

* Use multiple instances of the fake component

We mutate the inner component for its name so we need multiple copies.
2020-04-06 15:43:39 -07:00
Dominic Gannaway
a3875663f6 React Event System: cleanup plugins + break out update batching logic (#18503) 2020-04-06 22:01:20 +01:00
dependabot[bot]
717a33abb9 Bump minimist from 1.2.0 to 1.2.3 in /scripts/bench (#18500)
Bumps [minimist](https://github.com/substack/minimist) from 1.2.0 to 1.2.3.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.0...1.2.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-04-06 19:29:11 +01:00
dependabot[bot]
8c974a70c9 Bump minimist from 1.2.0 to 1.2.3 (#18501)
Bumps [minimist](https://github.com/substack/minimist) from 1.2.0 to 1.2.3.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.0...1.2.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-04-06 19:28:56 +01:00
Brian Vaughn
3498f13669 Profiler tooltip shows self duration (#18510) 2020-04-06 09:47:15 -07:00
Faelivrinx
c781156163 Fix performance issue in react-devtools when highlight enabled (#18498)
* Fix performance issue in react-devtools when highlight enabled

* getting minimum expiration time (fix)
2020-04-06 16:17:45 +01:00
Sophie Alpert
fe2cb52554 [eslint] Consider useRef() as ... as constant (#18496)
Sometimes you need to use casts, eg: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/28884#issuecomment-471341041. This change ignores them and allows you to still omit the ref object from the deps list.

Test Plan: unit tests
2020-04-05 14:13:34 -07:00
Sebastian Markbåge
1fd45437d7 Don't use checkPropTypes for internals (#18488)
We use console.error for internal warnings.
2020-04-04 15:10:46 -07:00
Zen
2ff27ec112 [eslint] strip tailing property in assignments (#16784)
* [eslint] strip tailing property in assignments

* inline `stripTailingPropInAssignment`
2020-04-04 14:26:39 +01:00
Nick Reiley
f625fce857 Add KeyboardEvent.code to synthetic event (#18287)
* Add KeyboardEvent.code to synthetic event

* remove null to 0 transformation

* make onKeyPress work
2020-04-04 14:24:46 +01:00
Sebastian Markbåge
5022fdfd5f Refactor Error Dialog Logging (#18487)
* Remove unnecessary CapturedError fields.

componentName is not necessary and is misleading when the error is caused
elsewhere in the stack. The stack is sufficient.

The many error boundary fields are unnecessary because they can be inferred
by the boundary itself.

* Don't attempt to build a stack twice

If it was possible, it would've been done in createCapturedValue.

* Push the work needed by the works into the forks

This avoids needing this in the npm published case.
2020-04-03 19:01:40 -07:00
Sebastian Markbåge
e2dd30898e [Flight] Lazily parse models and allow any value to suspend (#18476)
* Lazily initialize models as they're read intead of eagerly when received

This ensures that we don't spend CPU cycles processing models that we're
not going to end up rendering.

This model will also allow us to suspend during this initialization if
data is not yet available to satisfy the model.

* Refactoring carefully to ensure bundles still compile to something optimal

* Remove generic from Response

The root model needs to be cast at one point or another same as othe
chunks. So we can parameterize the read instead of the whole Response.

* Read roots from the 0 key of the map

The special case to read the root isn't worth the field and code.

* Store response on each Chunk

Instead of storing it on the data tuple which is kind of dynamic, we store
it on each Chunk. This uses more memory. Especially compared to just making
initializeBlock a closure, but overall is simpler.

* Rename private fields to underscores

Response objects are exposed.

* Encode server components as delayed references

This allows us to stream in server components one after another over the
wire. It also allows parallelizing their fetches and resuming only the
server component instead of the whole parent block.

This doesn't yet allow us to suspend deeper while waiting on this content
because we don't have "lazy elements".
2020-04-03 14:58:02 -07:00
Sebastian Markbåge
59fd09cb67 [Flight] Add webpack plugin build (#18485)
* Eject CRA from Flight

We need to eject because we're going to add a custom Webpack Plugin.

We can undo this once the plugin has upstreamed into CRA.

* Add Webpack plugin build

I call this entry point "webpack-plugin" instead of "plugin" even though
this is a webpack specific package. That's because there will also be a
Node.js plugin to do the server transform.

* Add Flight Webpack plugin to fixture

* Rm UMD builds

* Transform classes

* Rename webpack-plugin to plugin

This avoids the double webpack name. We're going to reuse this for both
server and client.
2020-04-03 14:04:56 -07:00
Luna Ruan
a876808f0a remove jsx plugin from react (#18484)
Now that the React JSX Babel Plugin is in Babel, remove this code from react
2020-04-03 13:00:50 -07:00
Hristo Kanchev
7785a5263e [DevTools] - Highlight rendered by elements on hover. (#18479)
* [DevTools] - Highlight rendered by elements on hover.

* Fixed formatting issue.

* DevTools - Extracted highlight logic to custom hook. Added highlight support for rendered by elements.

* Removed unnecessary padding style

* Removed unnecessary wrapper function.

Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-04-03 10:49:49 -07:00
Brian Vaughn
f312a3fc36 useMutableSource: bugfix for new getSnapshot with mutation (#18297) 2020-04-03 10:20:17 -07:00
Dan Abramov
a8f2165e83 Update to Jest 25 (#18480)
* Revert "Revert "Upgrade to jest 25 (#17896)" (#18376)"

This reverts commit fc7835c657.

* Other fixes

* Fix a broken test
2020-04-03 16:37:36 +01:00
Nick Reiley
c083a643b1 Add <progress> to DOM fixtures (#18293)
* Add <progress> to DOM fixtures

* Remove uncontrolled
2020-04-03 14:39:59 +01:00
Sebastian Markbåge
3c16baf848 Remove /dist/ UMD builds (#18473)
* Remove /dist/ UMD builds

We publish UMDs to npm (and we're considering stopping even that).

This means we'll stop publishing to http://react.zpao.com/builds/master/latest/

* Update fixture paths
2020-04-02 17:52:32 -07:00
Dominic Gannaway
91c9d69f9a Modern Event System: Remove TestUtils.SimulateNative support (#18471) 2020-04-03 00:12:47 +01:00
Dan Abramov
e55855e7ae Deprecate TestUtils.SimulateNative (#13407) 2020-04-02 23:48:03 +01:00
Brian Vaughn
4123d729e5 Revert "Revert: Enable new passive effect behavior for FB builds (#18467)" (#18468)
This reverts commit 3966081cf2.
2020-04-02 15:24:36 -07:00
Dominic Gannaway
8815e4cc72 Cleanup getListener and EventSystemFlags (#18469) 2020-04-02 23:17:10 +01:00
Dominic Gannaway
5e464546af ReactDOM.useEvent: fix scope propagation issue (#18464) 2020-04-02 18:26:56 +01:00
Dominic Gannaway
d5e4b3ae1d Modern Event System: refine flags and handling of enableLegacyFBSupport (#18466) 2020-04-02 18:26:34 +01:00
Dominic Gannaway
3966081cf2 Revert: Enable new passive effect behavior for FB builds (#18467) 2020-04-02 16:25:35 +01:00
Dan Abramov
7dfdff42af Run more flags in VARIANT tests (#18461)
* Run more flags in VARIANT tests

* Revert enabling modern system

* Fix
2020-04-02 16:19:09 +01:00
Dan Abramov
31734540dc Remove a flag for style collision warning (#18462) 2020-04-02 11:55:17 +01:00
Dominic Gannaway
663c13d71d Refactor Enter/Leave listener accumulation (#18405)
* Refactor Enter/Leave listener accumulation
2020-04-02 11:07:20 +01:00
Dan Abramov
c80cd8ee27 Revert "Fix email cursor jump (#18379)" (#18459)
* Revert "Fix email cursor jump (#18379)"

This reverts commit 9b88b78b3d.

* Leave fixtures be
2020-04-01 22:44:59 +01:00
Andrew Clark
58afba0663 Fix: Don't read primaryChild.childExpirationTime (#18457)
This is a variant of the fix in 5a0f1d. We can't rely on the primary
fiber's `childExpirationTime` field to be correct.

In this case, we can read from the Suspense boundary fiber instead.
This will include updates that exist in the fallback fiber, but that's
not a big deal; the important thing is that we don't drop updates.
2020-04-01 14:36:42 -07:00
Brian Vaughn
2ea7c60794 Fixed race condition in release script (#18456) 2020-04-01 14:17:55 -07:00
Dan Abramov
99d779f629 Don't close "Needs Investigation" issues (#18458) 2020-04-01 22:08:09 +01:00
Gabriel McAdams
3f46844899 [eslint-plugin-react-hooks] Added meta property (including docs) (#16607)
* [eslint-plugin-react-hooks] Added meta property (including docs)

* [eslint-plugin-react-hooks] Fixed typo (`RuleOfHooks` -> `RulesOfHooks`)

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
2020-04-01 21:13:10 +01:00
Dan Abramov
2bf60d9f9c Fix ESLint rule crash (#18455) 2020-04-01 20:54:42 +01:00
Sebastian Markbåge
3e94bce765 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
Sebastian Markbåge
e6ea3d3873 Use Closure Compiler to compile to ES5 instead of Babel (#18449)
* Upgrade Closure

There are newer versions but they don't yet have corresponding releases
of google-closure-compiler-osx.

* Configure build

* Refactor ReactSymbols a bit

Provides a little better output.
2020-04-01 12:08:37 -07:00
Utkarsh Kukreti
5200547100 Do not warn when a controlled input has onInput handler. (#18189)
`onInput` behaves the same as `onChange` for controlled inputs as far as I
know, so React should not print the following warning when `onInput` is
present.

> Failed prop type: You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.
2020-04-01 19:58:07 +01:00
Sebastian Silbermann
7516bdfce3 feat(createContext): Include displayName in warning (#18386) 2020-04-01 19:42:38 +01:00
Nick Reiley
9b88b78b3d Fix email cursor jump (#18379)
* add email input fixture to show cursor jump

* fix cursor jump in email input

Co-authored-by: Peter Potapov <dr.potapoff-peter@yandex.ru>

* add regression tests to ensure attributes are working

Co-authored-by: Peter Potapov <dr.potapoff-peter@yandex.ru>
2020-04-01 19:30:26 +01:00
Brian Vaughn
5ee0efe832 Remove state update warning for passive effect cleanup functions (#18453) 2020-04-01 10:49:24 -07:00
Dan Abramov
d8d2b6e89c Disable module components dynamically for WWW (#18446)
* Make disableModulePatternComponents dynamic for WWW

* Run both flags and tests and respect the flag in SSR
2020-04-01 18:31:59 +01:00
Sebastian Markbåge
e2c6702fca Remove ConcurrentMode and AsyncMode symbols (#18450)
This API was never released.
2020-04-01 10:18:52 -07:00
Dominic Gannaway
d6d5f5aabe Move accumulateEventTargetListeners to its own module/function (#18407) 2020-04-01 14:19:21 +01:00
Dominic Gannaway
dc3c6c9565 ReactDOM.useEvent: revert and add guard for null stateNode (#18441) 2020-04-01 12:45:26 +01:00
Sebastian Markbåge
0f334553c9 Reset stateNode in resetWorkInProgress (#18448)
* test(SuspenseList): Add failing test for class component

* Reset stateNode when resetWorkInProgress

This is supposed to put the Fiber into the same state as if it was just
created by child fiber reconciliation. For newly created fibers, that means
that stateNode is null.

Co-authored-by: Sebastian Silbermann <silbermann.sebastian@gmail.com>
2020-03-31 21:14:59 -07:00
Brian Vaughn
153b5c305d Cleanup previous shims directories before re-copying (#18447) 2020-03-31 12:22:02 -07:00
Brian Vaughn
4de3a60325 Remove disableMapsAsChildren flag (#18445)
Change warning to say the case is unsupported (not "will be deprecated")
2020-03-31 11:00:51 -07:00
Brian Vaughn
f4cc970276 Enable new passive effect behavior for FB builds (#18444)
* Enable new passive effect behavior for FB builds

Previously this behavior was controlled by GKs. This PR updates the flags to be enabled statically. It also enables the flags in the test builds.
2020-03-31 10:05:15 -07:00
Dan Abramov
9065e02d66 Fix a warning typo (#18443) 2020-03-31 15:55:30 +01:00
Dan Abramov
1960131f11 Add opt-in support for dangerous autofix (#18437) 2020-03-31 11:43:01 +01:00
Andrew Clark
90e90ac8e0 Revert useEvent PRs (#18438)
* Revert "ReactDOM.useEvent: enable on internal www and add inspection test (#18395)"

This reverts commit e0ab1a429d.

* Revert "ReactDOM.useEvent: Add support for experimental scopes API (#18375)"

This reverts commit a16b349745.

* ReactDOM.useEvent: Add support for experimental scopes API
2020-03-30 19:16:28 -07:00
Dan Abramov
da54641a10 [ESLint] Check deps when callback body is outside the Hook call, too (#18435)
* Refactor: visit CallExpression

Instead of visiting the functions and looking up to see if they're in a Hook call, visit Hook calls and look down to see if there's a callback inside. I will need this refactor so I can visit functions declared outside the call.

* Check deps when callback body is outside the Hook call

* Handle the unknown case
2020-03-31 02:09:32 +01:00
Dan Abramov
bf30e370a5 Remove User Timings (#18417) 2020-03-31 00:29:53 +01:00
Ricky
dd7e5e4f5a Add getInspectorDataForViewAtPoint (take two) (#18388)
* Add getInspectorDataForViewAtPoint (take two)

* Updates from review

* Add DEV to dev-only variable

* Missed this rename
2020-03-30 15:42:41 -04:00
Andrew Clark
d7382b6c43 Bugfix: Do not unhide a suspended tree without finishing the suspended update (#18411)
* Bugfix: Suspended update must finish to unhide

When we commit a fallback, we cannot unhide the content without including
the level that originally suspended. That's because the work at level
outside the boundary (i.e. everything that wasn't hidden during that
render) already committed.

* Test unblocking with a high-pri update
2020-03-30 11:25:04 -07:00
Dan Abramov
1f8c40451a Make interaction tracing on by default in all WWW builds (#18419) 2020-03-30 16:07:58 +01:00
Sebastian Silbermann
ba31ad40a9 feat(StrictMode): Double-invoke render for every component (#18430)
* feat(StrictMode): Double-invoke render for every component

* fix: Mark ReactTestRendererAsync as internal
2020-03-29 23:13:46 +01:00
Sebastian Markbåge
689d27586e Reset lastEffect when resuming SuspenseList (#18412)
We store an effect pointer so we can backtrack in the effect list in some
cases. This is a stateful variable. If we interrupt a render we need to
reset it.

This field was added after the optimization was added and I didn't remember
to reset it here.

Otherwise we end up not resetting the firstEffect so it points to a stale
list. As a result children don't end up inserted like we think they were.
Then we try to remove them it errors.

It would be nicer to just get rid of the effect list and use the tree for
effects instead. Maybe we still need something for deletions tho.
2020-03-29 10:13:17 -07:00
Rodrigo Graça
1af2a10891 https link to editorconfig.org (#18421) 2020-03-29 15:18:52 +01:00
zefeng
d7918f4a9b chore: npm link more directly (#18428) 2020-03-29 15:18:15 +01:00
Brian Vaughn
be4c8b19c1 Don't show destroy function state update warning when updating ancestors (#18409)
React can't directly detect a memory leak, but there are some clues that warn about one. One of these clues is when an unmounted React component tries to update its state. For example, if a component forgets to remove an event listener when unmounting, that listener may be called later and try to update state, at which point React would warn about the potential leak.

Warning signals like this are more useful if they're strong. For this reason, it's good to always avoid updating state from inside of an effect's cleanup function. Even when you know there is no potential leak, React has no way to know and so it will warn anyway.

In most cases we suggest moving state updates to the useEffect() body instead (to avoid triggering the warning). This works so long as the component is updating its own state (or the state of a descendant). However this will not work when a component updates its parent state in a cleanup function. If such a component is unmounted but its parent remains mounted, the state will be incorrect. For this reason, we now avoid showing the warning if a component is updating an ancestor.
2020-03-28 10:18:14 -07:00
Andrew Clark
35a2f74974 Delete leftover assignment from #18384
This assignment should have been deleted in #18384. It was deleted in
the other branches, but I missed this one. About to open a PR that
includes a test that covers this branch.
2020-03-27 15:17:30 -07:00
Andrew Clark
9d67847f7b [Bugfix] Dropped updates inside a suspended tree (#18384)
* Minor test refactor: `resolveText`

Adds a `resolveText` method as an alternative to using timers. Also
removes dependency on react-cache (for just this one test file; can do
the others later).

Timer option is still there if you provide a `ms` prop.

* Bugfix: Dropped updates in suspended tree

When there are multiple updates at different priority levels inside
a suspended subtree, all but the highest priority one is dropped after
the highest one suspends.

We do have tests that cover this for updates that originate outside of
the Suspense boundary, but not for updates that originate inside.

I'm surprised it's taken us this long to find this issue, but it makes
sense in that transition updates usually originate outside the boundary
or "seam" of the part of the UI that is transitioning.

* Bugfix: Suspense fragment skipped by setState

Fixes a bug where updates inside a suspended tree are dropped because
the fragment fiber we insert to wrap the hidden children is not part of
the return path, so it doesn't get marked during setState.

As a workaround, I recompute `childExpirationTime` right before deciding
to bail out by bubbling it up from the next level of children.

This is something we should consider addressing when we refactor the
Fiber data structure.

* Add back `lastPendingTime` field

This reverts commit 9a541139dfe36e8b9b02b1c6585889e2abf97389.

I want to use this so we can check if there might be any lower priority
updates in a suspended tree.

We can remove it again during the expiration times refactor.

* Use `lastPendingTime` instead of Idle

We don't currently have an mechanism to check if there are lower
priority updates in a subtree, but we can check if there are any in the
whole root. This still isn't perfect but it's better than using Idle,
which frequently leads to redundant re-renders.

When we refactor `expirationTime` to be a bitmask, this will no longer
be necessary because we'll know exactly which "task bits" remain.

* Add a test for updating the fallback
2020-03-26 11:31:40 -07:00
Dan Abramov
5bd1bc29b3 eslint-plugin-react-hooks@3.0.0 2020-03-26 17:59:25 +00:00
Dominic Gannaway
e0ab1a429d ReactDOM.useEvent: enable on internal www and add inspection test (#18395) 2020-03-26 17:13:05 +00:00
Brian Vaughn
6cceaeb67a DevTools v4.5.0 -> 4.6.0 2020-03-26 10:00:37 -07:00
Brian Vaughn
d92631eab1 Remove "es6-symbol" package from DevTools (#18397) 2020-03-26 09:31:36 -07:00
Dominic Gannaway
a16b349745 ReactDOM.useEvent: Add support for experimental scopes API (#18375)
* ReactDOM.useEvent: Add support for experimental scopes API
2020-03-26 13:29:54 +00:00
Sebastian Markbåge
dbb060d561 Pass BundlerConfig through to Relay Integration (#18393)
I wasn't sure we needed this but looks like it'll come in handy.
2020-03-25 20:25:54 -07:00
Sebastian Markbåge
ce6fe50b01 Add server-runtime to create Server Blocks (#18392)
This is equivalent to the jsx-runtime in that this is what the compiled
output on the server is supposed to target.

It's really just the same code for all the different Flights, but they
have different types in their arguments so each one gets their own entry
point. We might use this to add runtime warnings per entry point.

Unlike the client-side React.block call this doesn't provide the factory
function that curries the load function. The compiler is expected to wrap
this call in the currying factory.
2020-03-25 19:03:31 -07:00
Sebastian Markbåge
64ed221c3d Formalize the Wakeable and Thenable types (#18391)
* Formalize the Wakeable and Thenable types

We use two subsets of Promises throughout React APIs. This introduces
the smallest subset - Wakeable. It's the thing that you can throw to
suspend. It's something that can ping.

I also use a shared type for Thenable in the cases where we expect a value
so we can be a bit more rigid with our us of them.

* Make Chunks into Wakeables instead of using native Promises

This value is just going from here to React so we can keep it a lighter
abstraction throughout.

* Renamed thenable to wakeable in variable names
2020-03-25 16:49:37 -07:00
Sebastian Markbåge
a6924d77b1 Change .model getter to .readRoot method (#18382)
Originally the idea was to hide all suspending behind getters or proxies.
However, this has some issues with perf on hot code like React elements.

It also makes it too easy to accidentally access it the first time in an
effect or callback where things aren't allowed to suspend. Making it
an explicit method call avoids this issue.

All other suspending has moved to explicit lazy blocks (and soon elements).
The only thing remaining is the root. We could require the root to be an
element or block but that creates an unfortunate indirection unnecessarily.

Instead, I expose a readRoot method on the response. Typically we try to
avoid virtual dispatch but in this case, it's meant that you build
abstractions on top of a Flight response so passing it a round is useful.
2020-03-25 11:47:55 -07:00
Brian Vaughn
bd5781962a Inlined DevTools event emitter impl (#18378)
DevTools previously used the NPM events package for dispatching events. This package has an unfortunate flaw though- if a listener throws during event dispatch, no subsequent listeners are called. I've replaced that event dispatcher with my own implementation that ensures all listeners are called before it re-throws an error.

This commit replaces that event emitter with a custom implementation that calls all listeners before re-throwing an error.
2020-03-25 10:26:40 -07:00
Dan Abramov
6498f62edc Fix a mistake in ReactChildren refactor (#18380)
* Regression test for map() returning an array

* Add forgotten argument

This fixes the bug.

* Remove unused arg and retval

These aren't directly observable. The arg wasn't used, it's accidental and I forgot to remove. The retval was triggering a codepath that was unnecessary (pushing to array) so I removed that too.

* Flowify ReactChildren

* Tighten up types

* Rename getComponentKey to getElementKey
2020-03-25 09:20:46 +00:00
Dan Abramov
2ba43edc26 Rename internal fields (#18377) 2020-03-24 18:19:20 +00:00
Sebastian Markbåge
a317bd033f Flip the arguments of Blocks and make the query optional (#18374)
* Flip the arguments of Blocks and make the query optional

* Rename Query to Load
2020-03-24 10:58:23 -07:00
Andrew Clark
fc7835c657 Revert "Upgrade to jest 25 (#17896)" (#18376)
This reverts commit cf0081263c.

The changes to the test code relate to changes in JSDOM that come with Jest 25:

* Several JSDOM workarounds are no longer needed.
* Several tests made assertions to match incorrect JSDOM behavior (e.g. setAttribute calls) that JSDOM has now patched to match browsers.
  * https://codesandbox.io/s/resets-value-of-datetime-input-to-fix-bugs-in-ios-safari-1ppwh
* JSDOM no longer triggers default actions when dispatching click events.
  * https://codesandbox.io/s/beautiful-cdn-ugn8f
* JSDOM fixed (jsdom/jsdom#2700) a bug so that calling focus() on an already focused element does not dispatch a FocusEvent.
* JSDOM now supports passive events.
* JSDOM has improved support for custom CSS properties.
  * But requires jsdom/cssstyle#112 to land to support webkit prefixed properties.
2020-03-24 10:51:48 -07:00
Dominic Gannaway
0140118e8e ReactDOM.useEvent: add support for beforeblur/afterblur (#18370)
* ReactDOM.useEvent: add support for beforeblur/afterblur
2020-03-24 16:14:55 +00:00
Sebastian Markbåge
a56309fb88 [Flight] Integrate Blocks into Flight (#18371)
* Resolve Server-side Blocks instead of Components

React elements should no longer be used to extract arbitrary data but only
for prerendering trees.

Blocks are used to create asynchronous behavior.

* Resolve Blocks in the Client

* Tests

* Bug fix relay JSON traversal

It's supposed to pass the original object and not the new one.

* Lint

* Move Noop Module Test Helpers to top level entry points

This module has shared state. It needs to be external from builds.

This lets us test the built versions of the Noop renderer.
2020-03-23 17:53:45 -07:00
Dan Abramov
fc96a52be3 Refactor React.Children to reduce indirection (#18332)
* Don't pool traversal context

* Remove traverseAllChildrenImpl indirection

All usages are internal so we can simply use the inner function directly.

* Implement forEach through map

* Remove second usage of traverseAllChildren

This isn't useful by itself but makes the layering easier to follow. traverseAllChildren is only used at the lowest layer now.

* Reimplement count() and toArray() in terms of map()

* Inline the only use of mapSingleChildIntoContext

* Move forEach down in the file

* Use the language

Get rid of the traversal context. Use closures.

* Make mapIntoArray take an already escaped prefix

* Move count state out of mapIntoArray

* Inline traverseAllChildren into mapIntoArray

* Inline handleChild into mapIntoArray
2020-03-23 22:56:00 +00:00
Sebastian Markbåge
fd61f7ea53 Refactor Lazy Components to use teh Suspense (and wrap Blocks in Lazy) (#18362)
* Refactor Lazy Components

* Switch Blocks to using a Lazy component wrapper

Then resolve to a true Block inside.

* Test component names of lazy Blocks
2020-03-22 21:53:05 -07:00
Mohammad Aziz
31a9e391f7 Remove unnecessary lines for hasBadMapPolyfill issue for rollup (#16231) 2020-03-22 14:52:59 +00:00
Sebastian Markbåge
c0cd1be908 [Flight] Move bundler configs to use Suspense instead of returning thenable (#18367)
* Move bundler configs to use suspense instead of returning thenable

* Fix some Flow types
2020-03-21 22:28:36 -07:00
Sebastian Markbåge
4b7f8496a8 Rename CI jobs after the command line equivalent (#18364)
This makes it easier to know what to write on your command line to replicate
a failure locally.
2020-03-21 16:02:01 -07:00
Sebastian Markbåge
b779dd51e8 Stop syncing ReactTypes to RN (#18366)
This is a really old one and all callers have since been codemodded away
anyway because of problems.

This file is not really as rigorously maintained as the official Flow types
but has a few more specifics. However, the inconsistency causes problems
when you try to pass files typed using the built-in Flow typing for React
and mix it with these.

We just happen to get away with it because we compile out the types. If we
didn't we would hit those problems by even using these in our renderers.
2020-03-21 15:22:40 -07:00
Sebastian Markbåge
c5d2fc7127 Move some files out of /shared and rename to upper case (#18363)
* Rename lower case isomorphic default exports modules to upper case named exports

We're somewhat inconsistent here between e.g. ReactLazy and memo.

Let's pick one.

This also moves the responder, fundamental, scope creators from shared
since they're isomorphic and same as the other creators.

* Move some files that are specific to the react-reconciler from shared

Individual renderers are allowed to deep require into the reconciler.

* Move files specific to react-dom from shared

react-interactions is right now dom specific (it wasn't before) so we can
type check it together with other dom stuff. Avoids the need for
a shared ReactDOMTypes to be checked by RN for example.

* Move ReactWorkTags to the reconciler

* Move createPortal to export from reconciler

Otherwise Noop can't access it since it's not allowed deep requires.
2020-03-21 15:22:01 -07:00
Dominic Gannaway
a600408b28 ReactDOM.useEvent: add EventTarget support (#18355)
* ReactDOM.useEvent: add support for all EventTarget types
2020-03-20 18:31:47 +00:00
Dominic Gannaway
dbd85a08d9 ReactDOM.useEvent: support custom types (#18351)
* ReactDOM.useEvent: support custom types
2020-03-20 14:45:33 +00:00
Luna Ruan
7c1478680f fix string ref cannot be auto converted warning for React.jsxDEV (#18354)
The string ref cannot be auto converted warning was using the wrong _self. This diff fixes this so it is now using the correct __self
2020-03-19 23:47:53 -07:00
Andrew Clark
f198872716 Empty commit to fix master.
I accidentally did that thing again where I updated a PR branch to
be the same as the tip of master, which confused GitHub and caused it
to run PR checks against master.
2020-03-19 17:53:09 -07:00
Sebastian Markbåge
fc91508c1f Follow ups to bundler configs (#18352)
Follow ups from https://github.com/facebook/react/pull/18334

I also introduced the concept of a module reference on the client too.
We don't need this for webpack so that gets compiled out but we need it
for www. Similarly I also need a difference between preload and load.
2020-03-19 17:49:40 -07:00
Andrew Clark
31e6756b8c Remove error code step from publish script (#18350)
Error codes don't need to be pulled from CI anymore because the ones
in source are already expected to match the build output.

I noticed this when running the 16.13.1 release. Patch releases are cut
with the commit used to build the previous release as a base. So the
publish script accidentally reverted the changes that had landed to
the error codes file since then.
2020-03-19 14:45:07 -07:00
Dominic Gannaway
9e7f334c71 ModernEventSystem: fix event replaying (#18346)
* ModernEventSystem: fix event replaying
2020-03-19 20:44:38 +00:00
Dominic Gannaway
ffefb4e77f ModernEventSystem: refine Flow types (#18349) 2020-03-19 20:25:52 +00:00
Andrew Clark
6818a2aa01 Revert accidental changes to package.json (#18348)
The publish script was written before we switched to running patch
releases out-of-band, so when updating the local package.json version
numbers, it accidentally reverted other changes that have landed to
master since 16.13 was released.
2020-03-19 13:16:37 -07:00
Andrew Clark
ad445b127e Update package.jsons for 16.13.1 patch relase 2020-03-19 12:58:31 -07:00
Andrew Clark
8b48d52fb4 Changelog for 16.13.1 2020-03-19 12:36:34 -07:00
Dominic Gannaway
8311cb5d24 Modern Event System: refactor legacy FB support logic (#18336) 2020-03-19 13:22:36 +00:00
Dan Abramov
1cf4a170ac Stop exposing ReactDOMComponentTree from FB builds (#18338) 2020-03-18 20:35:58 +00:00
Ian Obermiller
d3368beeec [eslint-plugin-react-hooks] Disallow hooks in class components (#18341)
Per discussion at Facebook, we think hooks have reached a tipping point where it is more valuable to lint against potential hooks in classes than to worry about false positives.

Test plan:
```
# run from repo root
yarn test --watch RuleOfHooks
```
2020-03-18 19:55:13 +00:00
Sebastian Markbåge
8206b4b864 Wire up bundler configs (#18334)
This allows different flight server and clients to have different configs
depending on bundler to serialize and resolve modules.
2020-03-18 12:18:34 -07:00
Kerollos Magdy
6b7281ec14 [DevTools] Add shortcut keys for tab switching (#18248)
* [DevTools] Add shortcut keys for tab switching
* Use LocalStorage to remember most recently selected tab

Resolves #18227 and #18226

Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-03-18 11:05:41 -07:00
ItsByteMe
5152c4a9fd Fixed inconcistency with surrounding punctuation (#18339)
There was an inconsistency present on line 99 regarding the punctuation of the comment, all other comments found end in a period and this line had it's period omitted.
2020-03-18 17:10:32 +00:00
Sebastian Markbåge
94505b9613 Don't use EventListener Fork in Modern WWW Builds (#18333)
* Move unsubscribe fork to EventListener

That way we can statically compile out more of these indirections.

* Don't use the EventListener fork for Modern WWW builds
2020-03-18 13:13:50 +00:00
Luna Ruan
aae83a4b9a Fix UMD Builds (ReactSharedInternals)
ReactCurrentBatchConfig.suspense does not exist in ReactSharedInternals.umd. This PR adds it.
2020-03-17 17:56:14 -07:00
Dominic Gannaway
7d466bcc25 React Event System: Refactor ElementListenerMap for upgrading (#18308) 2020-03-18 00:15:50 +00:00
Dan Abramov
fe1f79b95b Don't fire the render phase update warning for class lifecycles (#18330)
* Change the warning to not say "function body"

This warning is more generic and may happen with class components too.

* Dedupe by the rendering component

* Don't warn outside of render
2020-03-18 00:07:14 +00:00
Sebastian Silbermann
22cab1cbd6 test(getComponentName): Increase test coverage (#18149)
Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-03-17 14:47:24 -07:00
Sebastian Silbermann
756e1ea5d4 fix(react-devtools-shared): useDebugValue with complex types (#18070)
Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-03-17 13:57:01 -07:00
Luna Ruan
90f8fe6f55 add jsx-runtime and jsx-dev-runtime (#18299)
This PR adds the jsx-runtime and jsx-dev-runtime modules for the JSX Babel Plugin. WWW still relies on jsx/jsxs/jsxDEV from the "react" module, so once we refactor the code to point to the runtime modules we will remove jsx/jsxs/jsxDEV from the "react" module.
2020-03-17 13:22:19 -07:00
Dan Abramov
26666427d6 Don't support older isomorphic React with newer renderers (#18329)
* Don't support older isomorphic React with newer renderers

* Remove the lazy hack
2020-03-17 19:30:10 +00:00
Dominic Gannaway
3a0076e0e8 useEvent: Small tweaks and changes (#18328) 2020-03-17 15:32:26 +00:00
Minh Nguyen
9240918536 Bump react-shallow-renderer to 16.13.1 (#18187) 2020-03-17 00:35:28 +00:00
Dominic Gannaway
c804f9aebb ReactDOM.useEvent: wire to event system to the hook (#18304) 2020-03-16 21:46:17 +00:00
Brian Vaughn
297f7588c4 Moved passive effects flag to be beside execution context (#18322) 2020-03-16 10:27:42 -07:00
Jovi De Croock
95df39b6b1 improve error message for cross-functional component updates (#18316)
* improve error message for cross-functional component updates

* correctly use %s by quoting it

* use workInProgress and lint

* add test assertion

* fix test

* Improve the error message

Co-authored-by: Dan Abramov <dan.abramov@me.com>
2020-03-16 17:05:30 +00:00
Brian Vaughn
c0ed0a2468 Replace passive effect context with boolean (#18309) 2020-03-16 09:56:43 -07:00
Brian Vaughn
730389b9d3 Warn against state updates from useEffect destroy functions (#18307)
Don't warn about unmounted state updates from within passive destroy function

* Fixed test conditional. (It broke after recent variant refactor.)
* Changed warning wording for setState from within useEffect destroy callback
2020-03-13 15:33:50 -07:00
Dominic Gannaway
0705b7282f Refine event system types + pass through priority (#18305) 2020-03-13 17:57:17 +00:00
Dominic Gannaway
45d26f6edb Remove un-used function arg (#18303) 2020-03-13 14:16:12 +00:00
Dan Abramov
73ff8b9094 Run ReactElementJSX-test against bundles (#18301)
* Run ReactElementJSX-test against bundles

* Try the new thing
2020-03-13 12:07:22 +00:00
Andrew Clark
8c015e0e14 Revert "Move MS Windows build to CircleCI (#17984)" (#18302)
This reverts commit 885ed46909.
2020-03-12 20:57:13 -07:00
wittgenst
885ed46909 Move MS Windows build to CircleCI (#17984)
* Move MS Windows build to CircleCI

* Update to latest NodeJS

Co-authored-by: Chris Lüer <lueer@fb.com>
2020-03-12 17:15:30 -07:00
Dominic Gannaway
2a7cd58956 ReactDOM.useEvent: Add DOM host event listener logic (#18292) 2020-03-12 22:41:33 +00:00
Dominic Gannaway
d3ec42020d Address feedback for accumulateTwoPhaseListeners (#18289) 2020-03-12 21:48:29 +00:00
Andrew Clark
cd48a06547 Set up infra for react-reconciler fork (#18285)
* ReactFiberReconciler -> ReactFiberReconciler.old

* Set up infra for react-reconciler fork

We're planning to land some significant refactors of the reconciler.
We want to be able to gradually roll out the new implementation side-by-
side with the existing one. So we'll create a short lived fork of the
react-reconciler package. Once the new implementation has stabilized,
we'll delete the old implementation and promote the new one.

This means, for as long as the fork exists, we'll need to maintain two
separate implementations. This sounds painful, but since the forks will
still be largely the same, most changes will not require two separate
implementations. In practice, you'll implement the change in the old
fork and then copy paste it to the new one.

This commit only sets up the build and testing infrastructure. It does
not actually fork any modules. I'll do that in subsequent PRs.

The forked version of the reconciler will be used to build a special
version of React DOM. I've called this build ReactDOMForked. It's only
built for www; there's no open source version.

The new reconciler is disabled by default. It's enabled in the
`yarn test-www-variant` command. The reconciler fork isn't really
related to the "variant" feature of the www builds, but I'm piggy
backing on that concept to avoid having to add yet another
testing dimension.
2020-03-12 11:38:32 -07:00
Andrew Clark
615df434bb Remove manual feature flag overrides (#18291)
Tests now run against both versions of these flags, using the
test-www-variant command. So we can remove the manual overrides.
2020-03-12 10:17:02 -07:00
Dominic Gannaway
99d271228d ReactDOM.useEvent: more scaffolding changes (#18282) 2020-03-12 09:12:06 +00:00
Brian Vaughn
97a8c72bf8 Wrap Components and Profiler tabs with box-size style too (#18286)
For the browser extension, these views get rendered into portals and so they don't inherit the box-sizing style from the .DevTools wrapper element. This causes views like the Profiler commit selector to subtly break.
2020-03-11 19:12:57 -07:00
Andrew Clark
5374919033 Empty commit to fix CI on master
Weird GitHub bug caused CI jobs to run against master as if it was
a PR. Now it looks like master is failing, even though it isn't.

Bloop.
2020-03-11 18:29:46 -07:00
Dominic Gannaway
8b155d2613 Flow type ReactDOMComponentTree (#18280) 2020-03-11 19:38:23 +00:00
Brian Vaughn
322cdcd3ab useMutableSource hook (#18000)
useMutableSource hook

useMutableSource() enables React components to safely and efficiently read from a mutable external source in Concurrent Mode. The API will detect mutations that occur during a render to avoid tearing and it will automatically schedule updates when the source is mutated.

RFC: reactjs/rfcs#147
2020-03-11 12:34:39 -07:00
Dominic Gannaway
30a998debf ModernEventSystem: refactor accumulateTwoPhaseListeners (#18274) 2020-03-11 18:55:01 +00:00
Andrew Clark
8fe066fdac Bugfix: "Captured" updates on legacy queue (#18265)
* Bugfix: "Captured" updates on legacy queue

This fixes a bug with error boundaries. Error boundaries have a notion
of "captured" updates that represent errors that are thrown in its
subtree during the render phase. These updates are meant to be dropped
if the render is aborted.

The bug happens when there's a concurrent update (an update from an
interleaved event) in between when the error is thrown and when the
error boundary does its second pass. The concurrent update is
transferred from the pending queue onto the base queue. Usually, at this
point the base queue is the same as the current queue. So when we
append the pending updates to the work-in-progress queue, it also
appends to the current queue.

However, in the case of an error boundary's second pass, the base queue
has already forked from the current queue; it includes both the
"captured" updates and any concurrent updates. In that case, what we
need to do is append separately to both queues. Which we weren't doing.

That isn't the full story, though. You would expect that this mistake
would manifest as dropping the interleaved updates. But instead what
was happening is that the "captured" updates, the ones that are meant
to be dropped if the render is aborted, were being added to the
current queue.

The reason is that the `baseQueue` structure is a circular linked list.
The motivation for this was to save memory; instead of separate `first`
and `last` pointers, you only need to point to `last`.

But this approach does not work with structural sharing. So what was
happening is that the captured updates were accidentally being added
to the current queue because of the circular link.

To fix this, I changed the `baseQueue` from a circular linked list to a
singly-linked list so that we can take advantage of structural sharing.

The "pending" queue, however, remains a circular list because it doesn't
need to be persistent.

This bug also affects the root fiber, which uses the same update queue
implementation and also acts like an error boundary.

It does not affect the hook update queue because they do not have any
notion of "captured" updates. So I've left it alone for now. However,
when we implement resuming, we will have to account for the same issue.

* Ensure base queue is a clone

When an error boundary captures an error, we append the error update
to the work-in-progress queue only so that if the render is aborted,
the error update is dropped.

Before appending to the queue, we need to make sure the queue is a
work-in-progress copy. Usually we clone the queue during
`processUpdateQueue`; however, if the base queue has lower priority
than the current render, we may have bailed out on the boundary fiber
without ever entering `processUpdateQueue`. So we need to lazily clone
the queue.

* Add warning to protect against refactor hazard

The hook queue does not have resuming or "captured" updates, but if
we ever add them in the future, we'll need to make sure we check if the
queue is forked before transfering the pending updates to them.
2020-03-11 11:53:45 -07:00
Sebastian Markbåge
b5c6dd2de5 Don't use Spread in DevTools Injection (#18277) 2020-03-11 10:58:25 -07:00
Sebastian Markbage
a463fef31b Revert "[React Native] Add getInspectorDataForViewAtPoint (#18233)"
This reverts commit bf351089a0.
2020-03-11 10:05:26 -07:00
Sebastian Markbåge
dc7eedae3c Encode server rendered host components as array tuples (#18273)
This replaces the HTML renderer with instead resolving host elements into
arrays tagged with the react.element symbol. These turn into proper
React Elements on the client.

The symbol is encoded as the magical value "$". This has security implications
so this special value needs to remain escaped for other strings.

We could just encode the element as {$$typeof: "$", key: key props: props}
but that's a lot more bytes. So instead I encode it as:
["$", key, props] and then convert it back.

It would be nicer if React's reconciler could just accept these tuples.
2020-03-11 09:48:02 -07:00
Ricky
bf351089a0 [React Native] Add getInspectorDataForViewAtPoint (#18233) 2020-03-11 16:12:41 +00:00
Sebastian Markbåge
99d7371863 [Flight] Split Streaming from Relay Implemenation (#18260)
* Add ReactFlightServerConfig intermediate

This just forwards to the stream version of Flight which is itself forked
between Node and W3C streams.

The dom-relay goes directly to the Relay config though which allows it to
avoid the stream part of Flight.

* Separate streaming protocol into the Stream config

* Split streaming parts into the ReactFlightServerConfigStream

This decouples it so that the Relay implementation doesn't have to encode
the JSON to strings. Instead it can be fed the values as JSON objects and
do its own encoding.

* Split FlightClient into a basic part and a stream part

Same split as the server.

* Expose lower level async hooks to Relay

This requires an external helper file that we'll wire up internally.
2020-03-10 14:55:04 -07:00
Dominic Gannaway
160505b0ca ReactDOM.useEvent: Add more scaffolding for useEvent hook (#18271) 2020-03-10 20:31:12 +00:00
Dominic Gannaway
a3bf668812 Flare: Fix listener upgrade bug (#18270) 2020-03-10 17:59:03 +00:00
Brian Vaughn
526c12f49e Enable enableProfilerCommitHooks flag for FB (#18230) 2020-03-10 10:40:45 -07:00
Kerollos Magdy
9e5626cdde Fix yarn warning on running 'yarn build-for-devtools' (#18232)
fixes #18231
2020-03-10 15:37:02 +00:00
Dominic Gannaway
29534252ad ReactDOM.useEvent add flag and entry point (#18267) 2020-03-10 12:18:49 +00:00
Dominic Gannaway
704c8b0118 Fix Flow type for AnyNativeEvent (#18266) 2020-03-10 10:46:12 +00:00
Sebastian Markbåge
bdc5cc4635 Add Relay Flight Build (#18242)
* Rename to clarify that it's client-only

* Rename FizzStreamer to FizzServer for consistency

* Rename react-flight to react-client/flight

For consistency with react-server. Currently this just includes flight
but it could be expanded to include the whole reconciler.

* Add Relay Flight Build

* Rename ReactServerHostConfig to ReactServerStreamConfig

This will be the config specifically for streaming purposes.
There will be other configs for other purposes.
2020-03-07 11:23:30 -08:00
Sebastian Markbåge
7a1691cdff Refactor Host Config Infra (getting rid of .inline*.js) (#18240)
* Require deep for reconcilers

* Delete inline* files

* Delete react-reconciler/persistent

This no longer makes any sense because it react-reconciler takes
supportsMutation or supportsPersistence as options. It's no longer based
on feature flags.

* Fix jest mocking

* Fix Flow strategy

We now explicitly list which paths we want to be checked by a renderer.
For every other renderer config we ignore those paths.

Nothing is "any" typed. So if some transitive dependency isn't reachable
it won't be accidentally "any" that leaks.
2020-03-06 16:20:42 -08:00
Sebastian Markbåge
238b57f0f7 [Blocks] Make it possible to have lazy initialized and lazy loaded Blocks (#18220)
* Lazify Blocks

Blocks now initialize lazily.

* Initialize Blocks eagerly in ChildFiber

This is for the case when it's a new Block that hasn't yet initialized.
We need to first initialize it to see what "render function" it resolves
to so that we can use that in our comparison.

* Remove extra import type line
2020-03-06 15:14:46 -08:00
Andrew Clark
235a6c4af6 Bugfix: Dropped effects in Legacy Mode Suspense (#18238)
* Failing: Dropped effects in Legacy Mode Suspense

* Transfer mounted effects on suspend in legacy mode

In legacy mode, a component that suspends bails out and commit in
its previous state. If the component previously had mounted effects,
we must transfer those to the work-in-progress so they don't
get dropped.
2020-03-06 11:10:01 -08:00
Andrew Clark
5fbb165602 Hard-code disableModulePatternComponents (#18239)
Hard-coding this until tests are fixed, to unblock master.
2020-03-06 11:09:36 -08:00
Brian Vaughn
cccba39f5b Fixed broken anchor tag for patch release 2020-03-06 11:05:01 -08:00
Dan Abramov
562cf013db Add a flag to disable module pattern components (#18133) 2020-03-06 18:46:32 +00:00
Andrew Clark
115cd12d9b Add test run that uses www feature flags (#18234)
In CI, we run our test suite against multiple build configurations. For
example, we run our tests in both dev and prod, and in both the
experimental and stable release channels. This is to prevent accidental
deviations in behavior between the different builds. If there's an
intentional deviation in behavior, the test author must account
for them.

However, we currently don't run tests against the www builds. That's
a problem, because it's common for features to land in www before they
land anywhere else, including the experimental release channel.
Typically we do this so we can gradually roll out the feature behind
a flag before deciding to enable it.

The way we test those features today is by mutating the
`shared/ReactFeatureFlags` module. There are a few downsides to this
approach, though. The flag is only overridden for the specific tests or
test suites where you apply the override. But usually what you want is
to run *all* tests with the flag enabled, to protect against unexpected
regressions.

Also, mutating the feature flags module only works when running the
tests against source, not against the final build artifacts, because the
ReactFeatureFlags module is inlined by the build script.

Instead, we should run the test suite against the www configuration,
just like we do for prod, experimental, and so on. I've added a new
command, `yarn test-www`. It automatically runs in CI.

Some of the www feature flags are dynamic; that is, they depend on
a runtime condition (i.e. a GK). These flags are imported from an
external module that lives in www. Those flags will be enabled for some
clients and disabled for others, so we should run the tests against
*both* modes.

So I've added a new global `__VARIANT__`, and a new test command `yarn
test-www-variant`. `__VARIANT__` is set to false by default; when
running `test-www-variant`, it's set to true.

If we were going for *really* comprehensive coverage, we would run the
tests against every possible configuration of feature flags: 2 ^
numberOfFlags total combinations. That's not practical, though, so
instead we only run against two combinations: once with `__VARIANT__`
set to `true`, and once with it set to `false`. We generally assume that
flags can be toggled independently, so in practice this should
be enough.

You can also refer to `__VARIANT__` in tests to detect which mode you're
running in. Or, you can import `shared/ReactFeatureFlags` and read the
specific flag you can about. However, we should stop mutating that
module going forward. Treat it as read-only.

In this commit, I have only setup the www tests to run against source.
I'll leave running against build for a follow up.

Many of our tests currently assume they run only in the default
configuration, and break when certain flags are toggled. Rather than fix
these all up front, I've hard-coded the relevant flags to the default
values. We can incrementally migrate those tests later.
2020-03-06 09:29:05 -08:00
Christoph Nakazawa
4027f2a3b8 Break up require/import statements in strings (#18222) 2020-03-05 22:27:55 +00:00
Brian Vaughn
024a764310 Implemented Profiler onCommit() and onPostCommit() hooks (#17910)
* Implemented Profiler onCommit() and onPostCommit() hooks
* Added enableProfilerCommitHooks feature flag for commit hooks
* Moved onCommit and onPassiveCommit behind separate feature flag
2020-03-05 11:02:00 -08:00
Brian Vaughn
d35f8a5818 feat: honor displayName of context types (#18224)
* Revert "Revert "feat: honor displayName of context types (#18035)" (#18223)"

This reverts commit 3ee812e6b6.

* Add warning of displayName is set on the consumer

* dedupe warning
2020-03-05 10:13:52 -08:00
Dominic Gannaway
3ee812e6b6 Revert "feat: honor displayName of context types (#18035)" (#18223)
This reverts commit 45c172d948.
2020-03-05 15:58:04 +00:00
Dominic Gannaway
6a0efddd89 Modern Event System: export internal FB flag for testing (#18221) 2020-03-05 14:05:00 +00:00
Sunil Pai
21b713b9fd Updated React Native home URL (#18218) 2020-03-05 13:15:46 +00:00
Dominic Gannaway
60b11f6c1b Modern Event System: Support nested portal/root boundaries (#18201) 2020-03-05 09:00:13 +00:00
Sebastian Markbåge
fa03206ee4 Remove _ctor field from Lazy components (#18217)
* This type is all wrong and nothing cares because it's all any

* Refine Flow types of Lazy Components

We can type each condition.

* Remove _ctor field from Lazy components

This field is not needed because it's only used before we've initialized,
and we don't have anything else to store before we've initialized.

* Check for _ctor in case it's an older isomorphic that created it

We try not to break across minors but it's no guarantee.

* Move types and constants from shared to isomorphic

The "react" package owns the data structure of the Lazy component. It
creates it and decides how any downstream renderer may use it.

* Move constants to shared

Apparently we can't depend on react/src/ because the whole package is
considered "external" as far as rollup is concerned.
2020-03-04 20:52:48 -08:00
Dominic Gannaway
2fe0fbb05e Use accumulateTwoPhaseDispatchesSingle directly (#18203) 2020-03-05 00:04:27 +00:00
Dominic Gannaway
503fd82b42 Modern Event System: Add support for internal FB Primer (#18210) 2020-03-04 23:41:59 +00:00
Brian Vaughn
45c172d948 feat: honor displayName of context types (#18035)
* test: Add test for current behavior of displayName
* feat: consider displayName of context types
2020-03-04 14:54:16 -08:00
Dominic Gannaway
83c3ed290c Fix instanceContainsElem bug from typo (#18213) 2020-03-04 19:53:16 +00:00
Vishal Jagtap
7e94d89f3e Updated React Native Website URL (#18207) 2020-03-04 12:10:48 +00:00
Brian Vaughn
355970aa4b DevTools 4.4.0 -> 4.5.0 2020-03-03 15:04:07 -08:00
Andrew Clark
ec652f4daf Bugfix: Expired partial tree infinite loops (#17949)
* Bugfix: Expiring a partially completed tree (#17926)

* Failing test: Expiring a partially completed tree

We should not throw out a partially completed tree if it expires in the
middle of rendering. We should finish the rest of the tree without
yielding, then finish any remaining expired levels in a single batch.

* Check if there's a partial tree before restarting

If a partial render expires, we should stay in the concurrent path
(performConcurrentWorkOnRoot); we'll stop yielding, but the rest of the
behavior remains the same.

We will only revert to the sync path (performSyncWorkOnRoot) when
starting on a new level.

This approach prevents partially completed concurrent work from
being discarded.

* New test: retry after error during expired render

* Regression: Expired partial tree infinite loops

Adds regression tests that reproduce a scenario where a partially
completed tree expired then fell into an infinite loop.

The code change that exposed this bug made the assumption that if you
call Scheduler's `shouldYield` from inside an expired task, Scheduler
will always return `false`. But in fact, Scheduler sometimes returns
`true` in that scenario, which is a bug.

The reason it worked before is that once a task timed out, React would
always switch to a synchronous work loop without checking `shouldYield`.

My rationale for relying on `shouldYield` was to unify the code paths
between a partially concurrent render (i.e. expires midway through) and
a fully concurrent render, as opposed to a render that was synchronous
the whole time. However, this bug indicates that we need a stronger
guarantee within React for when tasks expire, given that the failure
case is so catastrophic. Instead of relying on the result of a dynamic
method call, we should use control flow to guarantee that the work is
synchronously executed.

(We should also fix the Scheduler bug so that `shouldYield` always
returns false inside an expired task, but I'll address that separately.)

* Always switch to sync work loop when task expires

Refactors the `didTimeout` check so that it always switches to the
synchronous work loop, like it did before the regression.

This breaks the error handling behavior that I added in 5f7361f (an
error during a partially concurrent render should retry once,
synchronously). I'll fix this next. I need to change that behavior,
anyway, to support retries that occur as a result of `flushSync`.

* Retry once after error even for sync renders

Except in legacy mode.

This is to support the `useOpaqueReference` hook, which uses an error
to trigger a retry at lower priority.

* Move partial tree check to performSyncWorkOnRoot

* Factor out render phase

Splits the work loop and its surrounding enter/exit code into their own
functions. Now we can do perform multiple render phase passes within a
single call to performConcurrentWorkOnRoot or performSyncWorkOnRoot.
This lets us get rid of the `didError` field.
2020-03-03 13:42:18 -08:00
Brian Vaughn
d2158d6ccb Fix flow types (#18204)
* Added missing @flow pragma to React.js

* Fixed useContext() return type definition

* Fixed previously masked Flow errors in DevTools and react-interactions packages

* Added displayName to internal Context Flow type

* Removed Flow generic annotations for createResponder

This seems to cause a parsing error. (Not sure why.) The API is deprecated anyway so I'm being lazy for now and just adding a .
2020-03-03 12:46:24 -08:00
Dominic Gannaway
8e6a08ea4f Modern Event System: add plugin handling and forked paths (#18195) 2020-03-03 14:37:06 +00:00
Luna Ruan
7e83af17ce Put React.jsx and React.jsxDEV behind experimental build (#18023)
This PR puts the React.jsx and React.jsxDEV (enableJSXTransformAPI feature flag) in the experimental build so that we can use it to test React Native.
2020-03-02 18:08:40 -08:00
Dominic Gannaway
8cb2fb21eb Refine isFiberSuspenseAndTimedOut (#18184) 2020-03-02 14:15:42 +00:00
Dominic Gannaway
dbc7b9f50c Fix bug with PressLegacy blur (#18194) 2020-03-02 13:42:46 +00:00
Dominic Gannaway
62861bbcc7 More event system cleanup and scaffolding (#18179) 2020-03-02 10:59:07 +00:00
Sebastian Markbåge
8ccfce460f Only use Rollup's CommonJS plugin for "react-art" (#18186)
* Only use Rollup's CommonJS plugin for "react-art"

We still need it for the "art" UMD builds but nothing else should have
CommonJS dependencies anymore.

* react-debug-tools and jest-react should leave object-assign as an external dep

This avoids it being compiled into the output.
2020-02-28 16:46:16 -08:00
Minh Nguyen
c26506a7d2 Update react-shallow-renderer from 16.12.0 to 16.13.0 (#18185) 2020-02-28 16:35:52 -08:00
Eli White
26aa1987ce [Native] Enable and remove targetAsInstance feature flag. (#18182) 2020-02-28 13:45:42 -08:00
Sebastian Markbåge
4469700bb6 Change ReactVersion from CJS to ES module (#18181) 2020-02-28 13:09:02 -08:00
Sebastian Markbåge
58eedbb024 Check in a forked version of object-assign only for UMD builds (#18180)
* Check in a forked version of object-assign

This one uses ES modules so that we can inline it into UMD builds.

We could wait for object-assign to make an ESM export but we're going to
remove this dependency and assume global polyfills in the next version
anyway. However, we'd have to figure out how to keep the copyright header
and it'll get counted in terms of byte size (even if other tooling removes
it).

A lot of headache when we have our own implementation anyway. So I'll just
use that.

Ours is not resilient to checking certain browser bugs but those browsers
are mostly unused anyway. (Even FB breaks on them presumably.)

We also don't need to be resilient to Symbols since the way React uses it
we shouldn't need to copy symbols

* Don't transpile Object.assign to object-assign in object-assign

The polyfill needs to be able to feature detect Object.assign.
2020-02-28 11:14:09 -08:00
Henry Q. Dineen
053347e6bc react-test-renderer: improve findByType() error message (#17439)
* improve findByType error message

* fix flow typing

* Adding a test for the "Unknown" branch when `getComponentName()` returns a falsy value. The error message in this case not the most descriptive but seems consistent with the `getComponentName(type) || 'Unknown'` pattern seen in multiple places in this code base.
2020-02-28 17:55:33 +00:00
Dan Abramov
4ee592e95a Add an early invariant to debug a mystery crash (#18159) 2020-02-28 11:56:36 +00:00
Sophie Alpert
7ea4e4111f Fix typo in warning text (#18103)
Mentioned in #18090.
2020-02-28 11:53:20 +00:00
Simen Bekkhus
79a25125b1 feat: add recommended config eslint rule (#14762)
* feat: add recommended config eslint rule

* add exhaustive-deps to recommended as well
2020-02-28 02:01:17 +00:00
Joshua Gross
ae60caacfd [Fabric] Fix targetAsInstance dispatchEvent "cannot read property of null" (#18156)
* Fix Fabric targetAsInstance dispatchEvent: targetFiber stateNode is null in some cases

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
2020-02-27 17:23:25 -08:00
Dan Abramov
d72700ff5a Remove runtime dependency on prop-types (#18127)
* Remove runtime dep on prop-types

* Fix test
2020-02-28 01:21:54 +00:00
Sebastian Markbåge
549e418830 Move remaining things to named exports (#18165)
* Move remaining things to named exports

The interesting case here is the noop renderers. The wrappers around the
reconciler now changed to use a local export that gets mutated.

ReactNoop and ReactNoopPersistent now have to destructure the object to
list out the names it's going to export. We should probably refactor
ReactNoop away from createReactNoop. Especially since it's also not Flow
typed.

* Switch interactions to star exports

This will have esModule compatibility flag on them. They should ideally
export default instead.
2020-02-27 17:18:55 -08:00
Sebastian Markbåge
739f20beda Remove Node shallow builds (#18157)
This is just a forwarding module. We can hardcode it.
2020-02-27 14:11:40 -08:00
Sebastian Markbåge
3e809bf5d4 Convert React Native builds to named exports (#18136)
These don't need any forks because we always export the same things atm.
2020-02-27 11:33:44 -08:00
Dan Abramov
869dbda722 Don't build shallow renderer for FB (#18153) 2020-02-27 18:17:58 +00:00
Minh Nguyen
293878e079 Replace ReactShallowRenderer with a dependency (#18144)
Closes #17321.
2020-02-27 18:10:25 +00:00
Dan Abramov
abcca45951 Run test-prod job for experimental builds (#18152) 2020-02-27 16:21:36 +00:00
Dan Abramov
1ad2179002 Bust Circle caches 2020-02-27 15:33:10 +00:00
Dan Abramov
b4e3148918 Remove unused flag (#18132) 2020-02-27 12:58:15 +00:00
Dan Abramov
849e8328b5 Remove unnecessary warnings (#18135) 2020-02-27 02:14:30 +00:00
Sebastian Markbåge
f9c0a45441 Convert the rest of react-dom and react-test-renderer to Named Exports (#18145)
Nothing interesting here except that ReactShallowRenderer currently exports
a class with a static method instead of an object.

I think the public API is probably just meant to be createRenderer but
currently the whole class is exposed. So this means that we have to keep
it as default export. We could potentially also expose a named export for
createRenderer but that's going to cause compatibility issues.

So I'm just going to make that export default.

Unfortunately Rollup and Babel (which powers Jest) disagree on how to
import this. So to make it work I had to move the jest tests to imports.

This doesn't work with module resetting. Some tests weren't doing that
anyway and the rest is just testing ReactShallowRenderer so meh.
2020-02-26 18:04:32 -08:00
Brian Vaughn
2738b6d022 Updated CHANGELOG to remove passive effects change from 16.13 release. (It wasn't part of that release.) 2020-02-26 13:06:02 -08:00
Dan Abramov
69c769ae04 Fix changelog link 2020-02-26 21:04:36 +00:00
Dan
efaffc4797 Prettier 2020-02-26 21:02:20 +00:00
Sunil Pai
c1c5499cc3 update version numbers for 16.13 (#18143)
also includes a bugfix when downloading error codes from circleci.
2020-02-26 20:33:29 +00:00
Sunil Pai
169b1f79be Changelog for 16.13.0 (#18124)
* Changelog for 16.13.0

* Update CHANGELOG.md
2020-02-26 20:15:01 +00:00
Brian Vaughn
71418fda3b Rearranged some DevTools Components code 2020-02-26 11:33:52 -08:00
Hristo Kanchev
d166319e86 [DevTools] Added resize support for Components panel. (#18046)
* feat: DevTools - Added Resize Support.

* feat: Prettier.

* feat: DevTools - Added debug comments.

* feat: DevTools - Removed Use Memo.

* feat: DevTools - Added types.

* feat: DevTools - Extracted values to constants.

* feat: DevTools - Removed useCallback.

* feat: DevTools - Finished refactoring.

* feat: DevTools - Merging fixup.

* feat: DevTools - Prettier fix.

* feat: DevTools - Extracted code from Components fil.

* feat: DevTools - Fixed orientation change issue.

* feat: DevTools - Added flow types for reducer and refs.

* feat: DevTools - Fixed orientation change on initial load.

* Update packages/react-devtools-shared/src/devtools/views/Components/ComponentsResizer.js

* Removed unused `orientationRef`

* Fix Flow ref issue

Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-02-26 11:30:42 -08:00
Brian Vaughn
e1c7e651fe Update ReactDebugHooks to handle composite hooks (#18130)
The useState hook has always composed the useReducer hook. 1:1 composition like this is fine.

But some more recent hooks (e.g. useTransition, useDeferredValue) compose multiple hooks internally. This breaks react-debug-tools because it causes off-by-N errors when the debug tools re-renders the function.

For example, if a component were to use the useTransition and useMemo hooks, the normal hooks dispatcher would create a list of first state, then callback, then memo hooks, but the debug tools package would expect a list of transition then memo. This can break user code and cause runtime errors in both the react-debug-tools package and in product code.

This PR fixes the currently broken hooks by updating debug tools to be aware of the composite hooks (how many times it should call nextHook essentially) and adds tests to make sure they don't get out of sync again. We'll need to add similar tests for future composite hooks (like useMutableSource #18000).
2020-02-26 09:28:35 -08:00
Sunil Pai
d28bd2994b remove OSS testing builds (#18138)
The testing build versions of react-dom are included in the builds right now, but we're not ready to share them yet. This PR removes them for now (back soon for the next release)
2020-02-26 13:12:55 +00:00
Sebastian Markbåge
8e13e770e3 Remove /testing entry point from 'react' package (#18137)
We're not actually building this entry point. I can't think of a reason
we'd need to fork the isomorphic one. We don't really fork it for
anything since it's so generic to work with all renderers.

Since /profiling doesn't have this, it might confuse the story if we made
people alias two things for testing but not profiling.
2020-02-26 10:48:34 +00:00
Steve Harrison
f3ecd56bea Fixed a spelling mistake in a comment. (#18119) 2020-02-25 21:01:08 -08:00
Sebastian Markbåge
60016c448b Export React as Named Exports instead of CommonJS (#18106)
* Add options for forked entry points

We currently fork .fb.js entry points. This adds a few more options.

.modern.fb.js - experimental FB builds
.classic.fb.js - stable FB builds
.fb.js - if no other FB build, use this for FB builds
.experimental.js - experimental builds
.stable.js - stable builds
.js - used if no other override exists

This will be used to have different ES exports for different builds.

* Switch React to named exports

* Export named exports from the export point itself

We need to re-export the Flow exported types so we can use them in our code.

We don't want to use the Flow types from upstream since it doesn't have the non-public APIs that we have.

This should be able to use export * but I don't know why it doesn't work.

This actually enables Flow typing of React which was just "any" before.
This exposed some Flow errors that needs fixing.

* Create forks for the react entrypoint

None of our builds expose all exports and they all differ in at least one
way, so we need four forks.

* Set esModule flag to false

We don't want to emit the esModule compatibility flag on our CommonJS
output. For now we treat our named exports as if they're CommonJS.

This is a potentially breaking change for scheduler (but all those apis
are unstable), react-is and use-subscription. However, it seems unlikely
that anyone would rely on this since these only have named exports.

* Remove unused Feature Flags

* Let jest observe the stable fork for stable tests

This lets it do the negative test by ensuring that the right tests fail.

However, this in turn will make other tests that are not behind
__EXPERIMENTAL__ fail. So I need to do that next.

* Put all tests that depend on exports behind __EXPERIMENTAL__

Since there's no way to override the exports using feature flags
in .intern.js anymore we can't use these APIs in stable.

The tradeoff here is that we can either enable the negative tests on
"stable" that means experimental are expected to fail, or we can disable
tests on stable. This is unfortunate since some of these APIs now run on
a "stable" config at FB instead of the experimental.

* Switch ReactDOM to named exports

Same strategy as React.

I moved the ReactDOMFB runtime injection to classic.fb.js

Since we only fork the entrypoint, the `/testing` entrypoint needs to
be forked too to re-export the same things plus `act`. This is a bit
unfortunate. If it becomes a pattern we can consider forking in the
module resolution deeply.

fix flow

* Fix ReactDOM Flow Types

Now that ReactDOM is Flow type checked we need to fix up its types.

* Configure jest to use stable entry for ReactDOM in non-experimental

* Remove additional FeatureFlags that are no longer needed

These are only flagging the exports and no implementation details so we
can control them fully through the export overrides.
2020-02-25 13:54:27 -08:00
Dominic Gannaway
8d7535e540 Add @nolint to FB bundle headers (#18126) 2020-02-25 14:45:31 +00:00
Dominic Gannaway
a29a273c17 [react-interactions] Ensure blur to window disengages press (#18125) 2020-02-25 14:14:19 +00:00
Moji Izadmehr
bf13d3e3c6 [eslint-plugin-react-hooks] Fix cyclic caching for loops containing a… (#16853)
* [eslint-plugin-react-hooks] Fix cyclic caching for loops containing a condition

* [eslint-plugin-react-hooks] prettier write

* [eslint-plugin-react-hooks] Fix set for tests

* Update packages/eslint-plugin-react-hooks/src/RulesOfHooks.js

Co-Authored-By: Luke Kang <kidkkr@icloud.com>

Co-authored-by: Luke Kang <kidkkr@icloud.com>
2020-02-25 11:38:23 +00:00
Haseeb Furkhan Mohammed
0e49074f7a Cross platform support to run yarn test:edge for Microsoft Edge dev tools extension (#18108)
* Test automation for edge dev tools extension

* Linter changes

* Load extension automatically.

* Fixed path in `test` command

Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-02-24 18:17:01 -08:00
Sebastian Markbåge
ccab494738 Move type DOMContainer to HostConfig (#18112)
Exports from ReactDOM represents React's public API. This include types
exported by React. At some point we'll start building Flow types from
these files.

The duplicate name between DOMContainer and Container seems confusing too
since it was used in the same files even though they're the same.
2020-02-24 08:57:48 -08:00
adasq
501a78881e runAllPassiveEffectDestroysBeforeCreates's feature flag description typo fixed (#18115) 2020-02-24 14:49:13 +00:00
Sebastian Markbåge
be76966f6b Code mod import * as React from 'react' in react-window (#18105) 2020-02-21 23:20:17 -08:00
Sebastian Markbåge
09348798a9 Codemod to import * as React from "react"; (#18102)
* import * as React from "react";

This is the correct way to import React from an ES module since the ES
module will not have a default export. Only named exports.

* import * as ReactDOM from "react-dom"
2020-02-21 19:45:20 -08:00
Brian Vaughn
78e816032c Don't warn about unmounted updates if pending passive unmount (#18096)
I recently landed a change to the timing of passive effect cleanup functions during unmount (see #17925). This change defers flushing of passive effects for unmounted components until later (whenever we next flush pending passive effects).

Since this change increases the likelihood of a (not actionable) state update warning for unmounted components, I've suppressed that warning for Fibers that have scheduled passive effect unmounts pending.
2020-02-21 13:11:53 -08:00
Sebastian Markbåge
2c4221ce8b Change string refs in function component message (#18031)
This should refer to string refs specifically. The forwardRef part doesn't
make any sense in this case. I think this was just an oversight.
2020-02-21 10:12:34 -08:00
Sebastian Markbåge
65bbda7f16 Rename Chunks API to Blocks (#18086)
Sounds like this is the name we're going with. This also helps us
distinguish it from other "chunking" implementation details.
2020-02-20 23:56:40 -08:00
Dan Abramov
8b596e00a4 Remove unused arguments in the reconciler (#18092) 2020-02-21 02:26:19 +00:00
Andrew Clark
5de5b61507 Bugfix: memo drops lower pri updates on bail out (#18091)
Fixes a bug where lower priority updates on a components wrapped with
`memo` are sometimes left dangling in the queue without ever being
processed, if they are preceded by a higher priority bailout.

Cause
-----

The pending update priority field is cleared at the beginning of
`beginWork`. If there is remaining work at a lower priority level, it's
expected that it will be accumulated on the work-in-progress fiber
during the begin phase.

There's an exception where this assumption doesn't hold:
SimpleMemoComponent contains a bailout that occurs *before* the
component is evaluated and the update queues are processed, which means
we don't accumulate the next priority level. When we complete the fiber,
the work loop is left to believe that there's no remaining work.

Mitigation
----------

Since this only happens in a single case, a late bailout in
SimpleMemoComponent, I've mitigated the bug in that code path by
restoring the original update priority from the current fiber.

This same case does not apply to MemoComponent, because MemoComponent
fibers do not contain hooks or update queues; rather, they wrap around
an inner fiber that may contain those. However, I've added a test case
for MemoComponent to protect against a possible future regression.

Possible next steps
-------------------

We should consider moving the update priority assignment in `beginWork`
out of the common path and into each branch, to avoid similar bugs in
the future.
2020-02-20 16:21:31 -08:00
Kunuk Nykjær
abfbae02a4 Update Rollup version to 1.19.4 and fix breaking changes (#15037)
* update rollup versioni

* ignore Rollup warnings for known warning codes

* add lecacy support from elas7

* rollup 1.5

* upd to ver 1.6.0

* don't throw error

* use return instead of throw error

* upd code in comment

* fix getters test

* rollup 1.7

* rollup 1.7.3

* remove comments

* use rollup 1.7.4

* update yarn.lock for new rollup version

* rollup version 1.9.0

* rollback to version 1.7.4

* add globalThis to eslintrc.umd

* rollup 1.9.0

* upd rollup plugin versions to satisfied latest versions

* add result.json update

* rollup 1.9.3

* rollup 1.10.0

* ver 1.10.1

* rollup 1.11.3

* rollup ver 1.12.3

* rollup 1.13.1

* rollup 1.14.6

* rollup 1.15.6

* rollup 1.16.2

* upd tests

* prettier

* Rollup 1.16.3

* upd

* should throw when finding getters with a different syntax from the ones generated by Rollup

* add more one test

* rollup-plugin-prettier updated changed stuff, revert them

* don't upd all the Rollup plugins

* rollup-plugin-babel 3.0.7

* upd rollup plugin versions

* upd rollup-plugin-commonjs

* bracket spacing

* rollup 1.16.6

* rollup 1.16.7

* rename test description

* rollup 1.18.0

* use externalLiveBindings: false

* rollup 1.19.3

* remove remove-getters

* simplify CIRCULAR_DEPENDENCY warning

* simplify if logic in sizes-plugin

* rollup 1.19.4

* update output for small optimizations

* remove globalThis

* remove results.json file

* re-add globalThis
2020-02-20 22:09:30 +00:00
Sunil Pai
b789060dca Feature Flag for React.jsx` "spreading a key to jsx" warning (#18074)
Adds a feature flag for when React.jsx warns you about spreading a key into jsx. It's false for all builds, except as a dynamic flag for fb/www.

I also included the component name in the warning.
2020-02-20 11:30:04 +00:00
Dominic Gannaway
3f85d53ca6 Further pre-requisite changes to plugin event system (#18083) 2020-02-20 00:46:03 +00:00
Andrew Clark
ea6ed3dbbd Warn for update on different component in render (#17099)
This warning already exists for class components, but not for functions.

It does not apply to render phase updates to the same component, which
have special semantics that we do support.
2020-02-19 12:43:14 -08:00
Eli White
085d02133e [Native] Migrate focus/blur to call TextInputState with the host component (#18068) 2020-02-19 11:33:40 -08:00
Brian Vaughn
7e770dae93 Profiler tooltip tweaks (#18082)
* Moved Profiler views into Profiler folder

* Tweaked Profiler tooltip CSS styles

* Tweaked Tooltip positioning code
2020-02-19 10:58:45 -08:00
Dominic Gannaway
b6c94d636c Add guard around FocusWithin responder root events (#18080) 2020-02-19 18:32:18 +00:00
Dominic Gannaway
1000f6135e Add container to event listener signature (#18075) 2020-02-19 18:00:57 +00:00
Dan Abramov
a12dd52a4a Don't build some packages for WWW (#18078) 2020-02-19 17:59:42 +00:00
Moji Izadmehr
44e5f5e645 Add fiber summary tooltip to devtools profiling (#18048)
* Add tooltip component

* Separate logic of ProfilerWhatChanged to a component

* Add hovered Fiber info tooltip component

* Add flame graph chart tooltip

* Add commit ranked list tooltip

* Fix flow issues

* Minor improvement in filter

* Fix flickering issue

* Resolved issues on useCallbacks and mouse event listeners

* Fix lints

* Remove unnecessary useCallback
2020-02-19 09:44:31 -08:00
Dominic Gannaway
2512c309e3 Remove Flare bundles from build (#18077) 2020-02-19 17:25:41 +00:00
Sunil Pai
a8643e905e add no-restricted-globals to eslint config (#18076)
Our current lint config assumes a browser environment, which means it won't warn you if you use a variable like `name` without declaring it earlier. This imports the same list as the one used by create-react-app, and enables it against our codebase.
2020-02-19 17:14:53 +00:00
Dominic Gannaway
4912ba31e3 Add modern event system flag + rename legacy plugin module (#18073) 2020-02-19 14:36:39 +00:00
Andrew Clark
4d9f850065 Re-throw errors thrown by the renderer at the root in the complete phase (#18029)
* Re-throw errors thrown by the renderer at the root

React treats errors thrown at the root as a fatal because there's no
parent component that can capture it. (This is distinct from an
"uncaught error" that isn't wrapped in an error boundary, because in
that case we can fall back to deleting the whole tree -- not great, but
at least the error is contained to a single root, and React is left in a
consistent state.)

It turns out we didn't have a test case for this path. The only way it
can happen is if the renderer's host config throws. We had similar test
cases for host components, but none for the host root.

This adds a new test case and fixes a bug where React would keep
retrying the root because the `workInProgress` pointer was not advanced
to the next fiber. (Which in this case is `null`, since it's the root.)

We could consider in the future trying to gracefully exit from certain
types of root errors without leaving React in an inconsistent state. For
example, we should be able to gracefully exit from errors thrown in the
begin phase. For now, I'm treating it like an internal invariant and
immediately exiting.

* Add comment
2020-02-18 15:55:38 -08:00
Brian Vaughn
14afeb1033 Added missing feature flag 2020-02-18 14:49:57 -08:00
Brian Vaughn
691096c95d Split recent passive effects changes into 2 flags (#18030)
* Split recent passive effects changes into 2 flags

Separate flags can now be used to opt passive effects into:
1) Deferring destroy functions on unmount to subsequent passive effects flush
2) Running all destroy functions (for all fibers) before create functions

This allows us to test the less risky feature (2) separately from the more risky one.

* deferPassiveEffectCleanupDuringUnmount is ignored unless runAllPassiveEffectDestroysBeforeCreates is true
2020-02-18 14:19:43 -08:00
Andrew Clark
56d8a73aff [www] Disable Scheduler timeout w/ dynamic flag (#18069)
Before attempting to land an expiration times refactor, I want to see
if this particular change will impact performance (either positively
or negatively). I will test this with a GK.
2020-02-18 13:43:16 -08:00
Dominic Gannaway
1a6d8179b6 [react-interactions] Ensure onBeforeBlur fires for hideInstance (#18064) 2020-02-18 18:50:38 +00:00
Ryota Murakami
48c4867d74 Update issue templates to directly link to relevant sources (#18039)
GitHub supports linking to off-site sources for certain types of issue.
2020-02-18 10:30:00 -08:00
Brian Vaughn
90be006da8 Updated Yarn lockfile 2020-02-18 09:40:59 -08:00
Haseeb Furkhan Mohammed
d5ddc16a33 React developer tools extension for Microsoft Edge (#18041)
* Port Chrome extension to Microsoft Edge
2020-02-18 09:40:30 -08:00
Dominic Gannaway
f48a5e64e8 Further cleanup of plugin event system (#18056) 2020-02-18 13:31:59 +00:00
Dan Abramov
d533229fba Fix Prettier 2020-02-17 20:36:16 +00:00
Dan Abramov
56a8c35321 eslint-plugin-react-hooks@2.4.0 2020-02-17 20:26:56 +00:00
Will Douglas
93a229bab5 Update eslint rule exhaustive deps to use new suggestions feature (#17385)
This closes #16313
2020-02-17 20:24:27 +00:00
Dominic Gannaway
9def56ec0e Refactor DOM plugin system to single module (#18025) 2020-02-14 08:10:42 +00:00
Eli White
2d6be757df [Native] Delete NativeComponent and NativeMethodsMixin (#18036)
* [Native] Delete NativeComponent and NativeMethodsMixin

* Remove more files
2020-02-13 15:09:25 -08:00
Luna Ruan
d4f2b0379c Add Auto Import to Babel Plugin (#16626)
This babel transform is a fork of the @babel/plugin-transform-react-jsx transform and is for experimentation purposes only. We don't plan to own this code in the future, and we will upstream this to Babel at some point once we've proven out the concept.

As per the RFC to simplify element creation, we want to add the ability to auto import "react' directly from the babel plugin. This commit updates the babel plugin with two options:

1.) importSource: The React module to import from. Defaults to react.
2.) autoImport: The type of import. Defaults to none.
- none: Does not import React. JSX compiles to React.jsx etc.
- namespace: import * as _react from "react";. JSX compiles to _react.jsx etc.
- default: import _default from "react"; JSX compiles to _default.jsx etc.
- namedExports: import {jsx as _jsx} from "react"; JSX compiles to _jsx etc.
- require: var _react = _interopRequireWildcard(require("react"));. jSX compiles to _react.jsx etc.

namespace, default, and namedExports can only be used when sourceType: module and require can only be used when sourceType: script.

It also adds two pragmas (jsxAutoImport and jsxImportSource) that allow users to specify autoImport and importSource in the docblock.
2020-02-13 12:36:19 -08:00
Dan Abramov
8777b44e98 Add Modern WWW build (#18028)
* Build both stable and experimental WWW builds

* Flip already experimental WWW flags to true

* Remove FB-specific internals from modern FB builds

We think we're not going to need these.

* Disable classic features in modern WWW builds

* Disable legacy ReactDOM API for modern WWW build

* Don’t include user timing in prod

* Fix bad copy paste and add missing flags to test renderer

* Add testing WWW feature flag file

We need it because WWW has a different meaning of experimental now.
2020-02-13 20:33:53 +00:00
Sunil Pai
58b8797b73 remove "Unreleased" section from CHANGELOG (#18027)
This section is empty, and imo isn't really helpful in React's changelog. I'm honestly not sure why this is even here? Figured I'd start a discussion with a PR, or we can remove it right now.
2020-02-12 17:17:49 +00:00
Dan Abramov
a607ea4c42 Remove getIsHydrating (#18019) 2020-02-12 01:01:29 +00:00
Dominic Gannaway
988f4b14ee Do not export passiveBrowserEventsSupported from Focus responder (#18022)
Remove code
2020-02-11 15:57:37 -08:00
Brian Vaughn
f7278034de Flush all passive destroy fns before calling create fns (#17947)
* Flush all passive destroy fns before calling create fns

Previously we only flushed destroy functions for a single fiber.

The reason this is important is that interleaving destroy/create effects between sibling components might cause components to interfere with each other (e.g. a destroy function in one component may unintentionally override a ref value set by a create function in another component).

This PR builds on top of the recently added deferPassiveEffectCleanupDuringUnmount kill switch to separate passive effects flushing into two separate phases (similar to layout effects).

* Change passive effect flushing to use arrays instead of lists

This change offers a small advantage over the way we did things previous: it continues invoking destroy functions even after a previous one errored.
2020-02-11 09:52:54 -08:00
Dominic Gannaway
529e58ab0a Remove legacy www config from Rollup build (#18016) 2020-02-11 13:42:19 +00:00
Dominic Gannaway
42918f40aa Change build from babylon to babel (#18015) 2020-02-11 11:56:26 +00:00
Dominic Gannaway
df5faddcc2 Refactor commitPlacement to recursively insert nodes (#17996) 2020-02-10 23:38:24 +00:00
Dan Abramov
ab7b83a924 Stop exposing some internals on FB build (#18011) 2020-02-10 19:52:27 +00:00
Dan Abramov
517de74b0c Tweak comment wording (#18007)
* Revert "Update ReactFiberExpirationTime.js (#17825)"

This reverts commit b63cb6f6cf.

* Reword
2020-02-10 16:15:10 +00:00
haseeb
b63cb6f6cf Update ReactFiberExpirationTime.js (#17825)
replaced 'add' with 'subtract'
2020-02-10 12:37:49 +00:00
Jesse Katsumata
89c6042df3 fix: typo in test (#18005) 2020-02-10 12:34:09 +00:00
Sophie Alpert
4f71f25a34 Re-enable shorthand CSS property collision warning (#18002)
Originally added in https://github.com/facebook/react/pull/14181; disabled in https://github.com/facebook/react/pull/14245. Intention was to enable it in React 16.7 but we forgot.
2020-02-10 11:42:11 +00:00
Brian Vaughn
e05dedc415 Added $FlowFixMe to DevTools shell for module we Flow-ignore (#18001) 2020-02-07 14:36:51 -08:00
Dan Abramov
d1bfdfb861 Ignore react-native-web in Flow checks (#17999) 2020-02-07 16:24:25 +00:00
Dominic Gannaway
c55c34e46a Move React Map child check to behind flags or __DEV__ (#17995) 2020-02-07 12:21:50 +00:00
cutjavascript
901d76bc5c dataForRoots.set duplicate removal (#17993)
dataForRoots.set duplicate removal
2020-02-06 11:48:02 -08:00
Dan Abramov
3f814e7582 Fix Flow type for React Native (#17992) 2020-02-06 18:31:13 +00:00
Dominic Gannaway
256d78d11f Add feature flag for removing children Map support (#17990) 2020-02-06 13:19:35 +00:00
Dominic Gannaway
df134d31cb Use babel parser rather than Babylon in extract errors (#17988) 2020-02-06 12:46:32 +00:00
Brian Vaughn
9e158c091b Updated release script documentation and command names (#17929)
* Updated release script documentation and command names

* Update scripts/release/README.md

Co-Authored-By: Sunil Pai <threepointone@oculus.com>

* Updated README

Co-authored-by: Sunil Pai <threepointone@oculus.com>
2020-02-05 08:52:31 -08:00
Sunil Pai
d84c539b31 fix sizebot - point correctly to circleci artifact (#17975)
similar to #17972, this should fix sizebot not reporting stats right now
2020-02-04 14:03:12 -08:00
Brian Vaughn
613cbd3ace Formatting fix (Prettier) to build script 2020-02-04 11:37:38 -08:00
Brian Vaughn
562d2fbc49 Fix release scripts (#17972)
Circle CI seems to have changed the reported artifact path which broke our scripts.
2020-02-04 11:36:49 -08:00
Andrew Clark
9dba218d93 [Mock Scheduler] Mimic browser's advanceTime (#17967)
The mock Scheduler that we use in our tests has its own fake timer
implementation. The `unstable_advanceTime` method advances the timeline.

Currently, a call to `unstable_advanceTime` will also flush any pending
expired work. But that's not how it works in the browser: when a timer
fires, the corresponding task is added to the Scheduler queue. However,
we will still wait until the next message event before flushing it.

This commit changes `unstable_advanceTime` to more closely resemble the
browser behavior, by removing the automatic flushing of expired work.

```js
// Before this commit
Scheduler.unstable_advanceTime(ms);

// Equivalent behavior after this commit
Scheduler.unstable_advanceTime(ms);
Scheduler.unstable_flushExpired();
```

The general principle is to prefer separate APIs for scheduling tasks
and flushing them.

This change does not affect any public APIs. `unstable_advanceTime` is
only used by our own test suite. It is not used by `act`.

However, we may need to update tests in www, like Relay's.
2020-02-04 11:35:21 -08:00
Murat ÇATAL
cddde45806 apply changes on editablevalue on blur feature implemented (#17062)
* apply changes on editablevalue on blur feature implemented

* Removed "Undo" button and unnecessary event.preventDefault()

Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-02-04 11:05:01 -08:00
Dan Abramov
d6e08fe0a8 Remove Suspense priority warning (#17971)
* Remove Suspense priority warning

* Fix tests
2020-02-04 18:05:15 +00:00
Alfredo Granja
812277dab6 Fix onMouseEnter is fired on disabled buttons (#17675) 2020-02-04 14:56:55 +00:00
Hassan Alam
2078aa9a40 Add dom fixture for autofilled form state (#17951) 2020-02-04 14:53:35 +00:00
Sunil Pai
3e9251d605 make testing builds for React/ReactDOM (#17915)
This PR introduces adds `react/testing` and `react-dom/testing`.
- changes infra to generate these builds
- exports act on ReactDOM in these testing builds
- uses the new test builds in fixtures/dom

In the next PR -

- I'll use the new builds for all our own tests
- I'll replace usages of TestUtils.act with ReactDOM.act.
2020-02-03 23:31:31 +00:00
Sebastian Markbåge
ace9e8134c Simplify Continuous Hydration Targets (#17952)
* Simplify Continuous Hydration Targets

Let's use a constant priority for this. This helps us avoid restarting
a render when switching targets and simplifies the model.

The downside is that now we're not down-prioritizing the previous hover
target. However, we think that's ok because it'll only do one level too
much and then stop.

* Add test meant to show why it's tricky to merge both hydration levels

Having both levels co-exist works. However, if we deprioritize hydration
using a single level, we might deprioritize the wrong thing.

This adds a test that catches it if we ever try a naive deprioritization
in the future.

It also tests that we don't down-prioritize if we're changing the hover
in the middle of doing continuous priority work.
2020-02-03 12:47:14 -08:00
Brian Vaughn
7df32c4c8c Flush useEffect clean up functions in the passive effects phase (#17925)
* Flush useEffect clean up functions in the passive effects phase

This is a change in behavior that may cause broken product code, so it has been added behind a killswitch (deferPassiveEffectCleanupDuringUnmount)

* Avoid scheduling unnecessary callbacks for cleanup effects

Updated enqueuePendingPassiveEffectDestroyFn() to check rootDoesHavePassiveEffects before scheduling a new callback. This way we'll only schedule (at most) one.

* Updated newly added test for added clarity.

* Cleaned up hooks effect tags

We previously used separate Mount* and Unmount* tags to track hooks work for each phase (snapshot, mutation, layout, and passive). This was somewhat complicated to trace through and there were man tag types we never even used (e.g. UnmountLayout, MountMutation, UnmountSnapshot). In addition to this, it left passive and layout hooks looking the same after renders without changed dependencies, which meant we were unable to reliably defer passive effect destroy functions until after the commit phase.

This commit reduces the effect tag types to only include Layout and Passive and differentiates between work and no-work with an HasEffect flag.

* Disabled deferred passive effects flushing in OSS builds for now

* Split up unmount and mount effects list traversal
2020-02-03 12:30:01 -08:00
Evyatar
9944bf27fb Add version property to ReactDOM (#15780) 2020-02-03 11:19:04 -08:00
Dominic Gannaway
434770c3b4 Add beforeRemoveInstance method to ReactNoop (#17959) 2020-02-03 11:31:51 +00:00
Mark Huang
08c1f79e1e 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
Brian Vaughn
9ad35905fa Add DevTools tests for copying complex values (#17948) 2020-01-31 15:17:57 -08:00
Deniz Susman
00745b053f Typo fix (#17946) 2020-01-31 14:51:43 -08:00
Farhad Yasir
d9a5170594 fix: check bigint in serializeToString and change it to string (#17931) 2020-01-31 14:35:59 -08:00
Nicolas Gallagher
38cd75861f Update google-closure-compiler (#17902) 2020-01-30 17:34:03 -08:00
Brian Vaughn
6ae2c33a75 StrictMode should call sCU twice in DEV (#17942) 2020-01-30 13:03:44 -08:00
Andrew Clark
9dbe1c54df Revert "Bugfix: Expiring a partially completed tree (#17926)" (#17941)
This reverts commit 01974a867c.

* Failing test: Expiring a partially completed tree

We should not throw out a partially completed tree if it expires in the
middle of rendering. We should finish the rest of the tree without
yielding, then finish any remaining expired levels in a single batch.

* Check if there's a partial tree before restarting

If a partial render expires, we should stay in the concurrent path
(performConcurrentWorkOnRoot); we'll stop yielding, but the rest of the
behavior remains the same.

We will only revert to the sync path (performSyncWorkOnRoot) when
starting on a new level.

This approach prevents partially completed concurrent work from
being discarded.

* New test: retry after error during expired render
2020-01-30 11:14:57 -08:00
Brian Vaughn
d2ae77d0e4 Remove root.unmount() callback from DevTools code (#17939) 2020-01-30 09:36:43 -08:00
Sebastian Markbåge
e98797f7b9 Fix Event Replaying in Flare by Eagerly Adding Active Listeners (#17933)
* Add test of Event Replaying using Flare

* Fix Event Replaying in Flare by Eagerly Adding Active Listeners

This effectively reverts part of https://github.com/facebook/react/pull/17513
2020-01-30 09:32:41 -08:00
Dominic Gannaway
1662035852 Ensure createRoot warning parity with ReactDOM.render (#17937) 2020-01-30 17:17:42 +00:00
Dominic Gannaway
b2382a7150 Add ReactDOM.unstable_renderSubtreeIntoContainer warning flag (#17936) 2020-01-30 11:56:04 +00:00
Andrew Clark
01974a867c Bugfix: Expiring a partially completed tree (#17926)
* Failing test: Expiring a partially completed tree

We should not throw out a partially completed tree if it expires in the
middle of rendering. We should finish the rest of the tree without
yielding, then finish any remaining expired levels in a single batch.

* Check if there's a partial tree before restarting

If a partial render expires, we should stay in the concurrent path
(performConcurrentWorkOnRoot); we'll stop yielding, but the rest of the
behavior remains the same.

We will only revert to the sync path (performSyncWorkOnRoot) when
starting on a new level.

This approach prevents partially completed concurrent work from
being discarded.

* New test: retry after error during expired render
2020-01-29 12:40:18 -08:00
Dan Abramov
241c4467ee Add a note about expiring OTP codes 2020-01-29 16:31:51 +00:00
Dan Abramov
faabe22b4f Use next tag for canary releases in the doc (#17923) 2020-01-29 16:09:05 +00:00
Dan Abramov
57333ca33a Show first component stack in context warning (#17922)
* Update tests

* Show first component stack in context warning

Co-authored-by: Dominic Gannaway <trueadm@users.noreply.github.com>
2020-01-29 14:57:52 +00:00
Dan Abramov
a8fce06d3e Fix Jest diff call (#17921) 2020-01-29 14:38:22 +00:00
Dan Abramov
29a1559619 Add semver dependency explicitly to DevTools (#17919) 2020-01-29 14:20:56 +00:00
Dominic Gannaway
b7f217d40c [Concurrent Mode] Add missing event plugin priorities (#17914) 2020-01-28 13:20:26 +00:00
Brian Vaughn
e26682a9f3 Removed Root API callback params and added warnings (#17916) 2020-01-27 12:35:08 -08:00
Simen Bekkhus
cf0081263c Upgrade to jest 25 (#17896)
The changes to the test code relate to changes in JSDOM that come with Jest 25:

* Several JSDOM workarounds are no longer needed.
* Several tests made assertions to match incorrect JSDOM behavior (e.g. setAttribute calls) that JSDOM has now patched to match browsers.
  * https://codesandbox.io/s/resets-value-of-datetime-input-to-fix-bugs-in-ios-safari-1ppwh
* JSDOM no longer triggers default actions when dispatching click events.
  * https://codesandbox.io/s/beautiful-cdn-ugn8f
* JSDOM fixed (jsdom/jsdom#2700) a bug so that calling focus() on an already focused element does not dispatch a FocusEvent.
* JSDOM now supports passive events.
* JSDOM has improved support for custom CSS properties.
  * But requires jsdom/cssstyle#112 to land to support webkit prefixed properties.
2020-01-25 08:43:02 -08:00
Nicolas Gallagher
6faf6f5eb1 Update to flow 0.97 (#17892) 2020-01-24 10:52:38 -08:00
Nicolas Gallagher
81e30c7ff6 Remove unused modules from legacy event responders (#17907) 2020-01-24 10:50:27 -08:00
Nicolas Gallagher
9d09052d2f Update various monorepo dependencies (#17901) 2020-01-24 10:28:50 -08:00
Simen Bekkhus
3c713d5131 chore: update to latest release of babel (#17897) 2020-01-24 17:49:24 +00:00
Luna Ruan
3b3decf871 add warning when owner and self are different for string refs (#17864)
When owner and self are different for string refs, we can't easily convert them to callback refs. This PR adds a warning for string refs when owner and self are different to tell users to manually update these refs.
2020-01-22 12:32:51 -08:00
Nicolas Gallagher
6c00c5bba4 Update to flow-bin@0.89 (#17842) 2020-01-22 10:02:30 -08:00
Sebastian Markbåge
cf7a0c24d4 Remove dynamic GKs for selective/train (#17888)
There are shipped/shipping.
2020-01-21 19:43:35 -08:00
Dominic Gannaway
c322f5913f Add unstable_renderSubtreeIntoContainer and unstable_createPortal feature flags (#17880) 2020-01-21 21:17:42 +00:00
Dominic Gannaway
f2fd484afd Add React.createFactory() deprecation warning (#17878) 2020-01-21 15:51:39 +00:00
Sebastian Markbåge
0c04acaf89 Remove FB specific build (#17875)
I moved unstable_SuspenseList internally. We don't need the FB build.
I plan on also removing the ReactDOM fb specific entry. We shouldn't add
any more FB specific internals nor APIs. If they're experimental they
should go onto the experimental builds to avoid too many permutations.
2020-01-20 16:06:01 -08:00
Dominic Gannaway
9fd760ce75 Add disable <textarea/> children flag (#17874) 2020-01-20 15:12:30 +00:00
Dominic Gannaway
a209a97ed7 Add feature flag around React.createFactory (#17873) 2020-01-20 15:00:18 +00:00
Andrew Clark
95bd7aad7d Remove renderPhaseUpdates Map (#17625)
* Remove renderPhaseUpdates Map

Follow up to #17484, which was reverted due to a bug found in www.

* Failing test: Dropped updates

When resetting render phase updates after a throw, we should only clear
the pending queue of hooks that were already processed.

* Fix non-render-phase updates being dropped

Detects if a queue has been processed by whether the hook was cloned.
If we change the implementation to an array instead of a list, we'll
need some other mechanism to determine whether the hook was processed.

* Regression test: startTransition in render phase

useTransition uses the state hook as part of its implementation, so we
need to fork it in the dispatcher used for re-renders, too.
2020-01-17 16:00:35 -05:00
Bogdan
29b4d0721c Allow debug-test commands to run on Windows (#17122)
Fix #17121
2020-01-17 10:20:09 -08:00
Dominic Gannaway
b43b36dd91 Remove ReactInstanceMap_DO_NOT_USE shim (#17861) 2020-01-17 12:37:55 +00:00
Dominic Gannaway
9e075d16b2 [react-interactions] Remove deprecated Scope APIs + update Focus components/docs (#17859) 2020-01-17 12:16:39 +00:00
Brian Vaughn
bc1f3e1a69 Fix DevTools Flow error for key-sort function (#17849) 2020-01-15 09:45:16 -08:00
Dominic Gannaway
b6173e643a [react-interactions] Add DO_NOT_USE to Scope methods (#17835) 2020-01-15 09:50:09 +00:00
Brian Vaughn
8aefb1995c Removed 'reactInternal' reference in DevTools overlay highlighter (#17841) 2020-01-14 15:38:09 -08:00
Jason Williams
643dcb5526 Add support for Node v13 for development (#17837) 2020-01-14 23:20:42 +00:00
Brian Vaughn
1e1a989422 Re-enabled DevTools context menu option in Firefox to inspect function prop source (#17838) 2020-01-14 14:00:28 -08:00
Nicolas Gallagher
3bd6adceda Update typescript package and jest preprocessor (#17839) 2020-01-14 13:52:52 -08:00
Nicolas Gallagher
50eafef07e Update babel-eslint and eslint packages (#17829) 2020-01-14 09:26:44 -08:00
André
4f480d0645 Fix typo in TestCase description (#17077) 2020-01-12 11:54:12 -08:00
Dan
f4ca909e0e react-refresh@0.7.2 2020-01-12 17:54:30 +00:00
Dan Abramov
255d9ac5f5 [Fresh] Fix edge case with early function call (#17824) 2020-01-12 17:53:50 +00:00
Nicolas Gallagher
64aae7b06f Fix issue template for questions (#17817) 2020-01-10 10:57:34 -08:00
Emily
d8570ec6ea Create ReactFabric.stopSurface and use that for bridgeless mode binding (#16164) 2020-01-10 10:21:32 -08:00
Nicolas Gallagher
05e487a12f Add GitHub issue templates (#17815) 2020-01-09 16:16:37 -08:00
Ganapati V S
5d6129b5d1 Update ReactSuspenseList-test.internal.js (#17034)
Typo
2020-01-09 14:14:00 -08:00
Dawid Loranc
ff900095b9 Fix message typo in printOperationsArray function (#17039) 2020-01-09 14:13:03 -08:00
Alican Çubukçuoğlu
1b6e269751 Create SECURITY.md (#15784)
Adds SECURITY.md as mentioned in #15722.
2020-01-09 14:07:41 -08:00
Tao
3ac81a57fb Update create-react-app note for eslint-plugin-react-hooks (#16982)
eslint-plugin-react-hooks was added in react-scripts 3.0.0
2020-01-09 13:47:05 -08:00
Brian Vaughn
435259f189 Add better test coverage for hooks in DevTools Profiler's change-detection (#17816) 2020-01-09 13:15:19 -08:00
Nicolas Gallagher
2e4948a34d Add configuration for the "Stale" GitHub App (#17806)
Configuration for the bot that marks and closes stale issues and pull requests.
https://probot.github.io/apps/stale/
2020-01-09 11:13:41 -08:00
Dan Abramov
e706721490 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 Abramov
b979db4e72 Bump Prettier (#17811)
* Bump Prettier

* Reformat

* Use non-deprecated option
2020-01-09 13:54:11 +00:00
Sebastian Markbåge
18875b2401 Remove special casing of toString values when enableTrustedTypesIntegration (#17774)
* Remove toString of dangerouslySetInnerHTML

As far as I can tell, the toString call was added here:

caae627cd5 (diff-5574f655d491348f422bca600ff6711dR887)

It was never really needed. Subsequently when we added Trusted Types,
this needed to be changed to a special call but we really should just
always let it pass through.

* Remove special casing of toString values when enableTrustedTypesIntegration

As far as I can tell, we only toString in user space because of IE8/9.

We don't really support IE8/9 anymore and by the time this flag is on,
we should be able to deprecate it.

Unless this is also an issue in IE11. I haven't tested yet.
2020-01-08 14:40:07 -08:00
Eli White
19f6fe170c Revert "Revert "Dispatch commands to both UIManagers from both renderers (#17211)" (#17232)" (#17799)
* Revert "Revert "Dispatch commands to both UIManagers from both renderers (#17211)" (#17232)"

This reverts commit d0fc0ba0a6.

* Clean up another __DEV__ warning check
2020-01-07 16:47:19 -08:00
Brian Vaughn
6250462bed Renamed "ReactDOM-fb" imports to "ReactDOM" in www shims (#17797)
* Renamed "ReactDOM-fb" imports to "ReactDOM" in www shims

* Removed ReactDOMComponentTree_DO_NOT_USE.js
2020-01-07 13:05:36 -08:00
Dominic Gannaway
5e21157d86 [react-interactions] Fix Hover issues with portals (#17765) 2020-01-07 19:45:26 +00:00
Brian Vaughn
40568e9773 Updated DevTools CHANGELOG to add pending release details 2020-01-06 10:37:20 -08:00
Brian Vaughn
5586b3022c Merge branch 'GasimGasimzada-scope-devtools-styles' 2020-01-06 10:36:13 -08:00
Brian Vaughn
7580d6717c Fixed padding problem in standalone shell 2020-01-06 10:35:36 -08:00
Brian Vaughn
80e32487b9 Fixed box-sizing problem in test shell 2020-01-06 10:23:55 -08:00
Brian Vaughn
c1b573bf2f Merge branch 'scope-devtools-styles' of https://github.com/GasimGasimzada/react into GasimGasimzada-scope-devtools-styles 2020-01-06 10:13:35 -08:00
Brian Vaughn
fc921a1693 Updated DevTools CHANGELOG to add pending release details 2020-01-06 10:12:26 -08:00
Brian Vaughn
1c63b2e416 Renamed "backend.js" to "react_devtools_backend.js" (#17790) 2020-01-06 09:29:20 -08:00
Brian Vaughn
2bb227ef80 DevTools: Improve function props display for inspected elements (#17789) 2020-01-06 09:19:59 -08:00
Brian Vaughn
24f824250f DevTools Profiler: Improve how empty commits are filtered (#17771)
Previously, DevTools filtered empty commits on the backend, while profiling, through the use of a bailout heuristic that React currently happens to use. This approach was brittle and may have exacerbated the long-standing Profiler bug #16446.

This PR removes that heuristic and adds as a post-processing filtering pass instead. This removes the coupling between DevTools and a React internal implementation detail that may change.

I believe DevTools has two choices of criteria for this filtering:
* Filter commits that have no actual duration metadata.
* Filter commits that have no recorded operations (no mutations to the tree, no changed tree base durations).

I chose the first option, filtering by commits that have no reported metadata. It will miss an edge case, e.g. , but we would have nothing meaningful to show in the Profiler for those cases anyway. (This particular edge case is why one of the snapshots changed with this commit.)

The second option, filtering by recorded operations, could potentially miss a more important edge case: where a component *did* render, but its  didn't change. (In that event, there would be no operations to send.)
2020-01-04 16:50:39 -08:00
Sebastian Markbåge
edeea07207 Remove toString of dangerouslySetInnerHTML (#17773)
As far as I can tell, the toString call was added here:

caae627cd5 (diff-5574f655d491348f422bca600ff6711dR887)

It was never really needed. Subsequently when we added Trusted Types,
this needed to be changed to a special call but we really should just
always let it pass through.
2020-01-04 05:47:23 -08:00
Gasim Gasimzada
9cc094a19a Scope dev tools wildcard styles within DevTools CSS class 2020-01-04 14:04:15 +04:00
Brian Vaughn
f749045a5b DevTools 4.3.0 -> 4.4.0 2020-01-03 10:02:50 -08:00
Sebastian Markbåge
59f21f1b24 HostText needs to copy over from current if it is unchanged in persistent mode (#17538)
stateNode is not one of the fields that gets copied over by createWorkInProgress.

This is bad for persistent mode since it's not the same instance.

In HostComponent we happened to always end up transferring the current stateNode when we bail.
However, we didn't do this for HostText.
2020-01-03 17:35:17 +00:00
Brian Vaughn
7e2ab87a61 DevTools: Replaced unsafe hasOwnProperty() calls (#17768)
DevTools previously called  in several places with user-defined values. This could lead to runtime errors if those values had an overriden  attribute. This commit replaces those callse with  instead.

New test cases have been added.
2020-01-03 09:34:12 -08:00
Brian Vaughn
5d3d71b1dd Partial fix DevTools Profiler ''Could not find node…'' error (#17759)
The Profiler stores:

1. A snapshot of the React tree when profiling started
2. The operations array for each commit
3. Profiling metadata (e.g. durations, what changed, etc) for each commit

It uses this information (snapshot + operations diff) to reconstruct the state of the application for a given commit as it's viewed in the Profiler UI. Because of this, it's very important that the operations and metadata arrays align. If they don't align, the profiler will be unable to correctly reconstruct the tree, and it will likely throw errors (like 'Could not find node…')

#16446 tracks a long-standing bug where these two arrays get misaligned. I am still not entirely sure what causes this bug, but with PR #17253, I exacerbated things by introducing another potential way for it to happen. This PR addresses the regression at least (and adds test coverage for it).

I will follow up this afternoon on the original #16446 issue. I think I may have a lead on what's happening at least, if not exactly an idea of how to reproduce it.
2020-01-03 09:28:31 -08:00
Brian Vaughn
cca994c6a1 DevTools Profiler commit selector wraps around (#17760)
I used to disable the <- and -> buttons when you reached the beginning or end of the profiler data. This can be kind of annoying though when you just want to get to the last commit, and I don't think there's a good reason to enforce it anyway, so I backed that change out. The buttons now wrap around at the beginning or end of the list.
2020-01-02 14:44:07 -08:00
Brian Vaughn
b05cd611ba Fixed CircleCI DevTools build artifact tar internal structure (#17758) 2020-01-02 09:28:20 -08:00
Brian Vaughn
195b3db618 Added missing guard to DevTools for Objects with null proto (#17757)
This prevents a runtime error from occurring when these objects are inspected.
2020-01-02 08:27:29 -08:00
Brian Vaughn
2c1e5d2b22 Build and store DevTools artifacts in Circle CI (#17746) 2020-01-01 07:58:47 -08:00
Brian Vaughn
86883d7aac Updated DevTools pending CHANGELOG 2019-12-30 09:12:49 -08:00
dependabot[bot]
b4e2fac09d Bump handlebars from 4.0.11 to 4.5.3 in /fixtures/expiration (#17729)
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.0.11 to 4.5.3.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/wycats/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.0.11...v4.5.3)

Signed-off-by: dependabot[bot] <support@github.com>
2019-12-30 08:57:08 -08:00
dependabot[bot]
e6226e6493 Bump handlebars from 4.0.6 to 4.5.3 in /fixtures/dom (#17730)
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.0.6 to 4.5.3.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/wycats/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.0.6...v4.5.3)

Signed-off-by: dependabot[bot] <support@github.com>
2019-12-30 08:56:44 -08:00
dependabot[bot]
3bec713b85 Bump handlebars from 4.0.10 to 4.5.3 in /fixtures/attribute-behavior (#17728)
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.0.10 to 4.5.3.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/wycats/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.0.10...v4.5.3)

Signed-off-by: dependabot[bot] <support@github.com>
2019-12-30 08:56:11 -08:00
dependabot[bot]
ee38c00bd5 Bump handlebars from 4.0.6 to 4.5.3 in /fixtures/fiber-debugger (#17727)
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.0.6 to 4.5.3.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/wycats/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.0.6...v4.5.3)

Signed-off-by: dependabot[bot] <support@github.com>
2019-12-30 08:56:05 -08:00
dependabot[bot]
4d463fce4e Bump handlebars from 4.1.2 to 4.5.3 (#17732)
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.1.2 to 4.5.3.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/wycats/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.1.2...v4.5.3)

Signed-off-by: dependabot[bot] <support@github.com>
2019-12-30 08:46:41 -08:00
Karan Sharma
d259f45813 Fix various typos (#17724) 2019-12-29 13:47:51 -08:00
Chris Watson
9357a483e9 Fix for the standalone devtools not responding to clicks. (#17584) 2019-12-29 13:46:27 -08:00
Brian Vaughn
22ef96ae63 Devtools renable copy attr context menu for firefox (#17740)
* Use exportFunction() to share clipboard copy with JS running in document/page context.

* Remove no-longer-used option to disable copy operation.
2019-12-29 13:27:44 -08:00
Brian Vaughn
2b903da355 Make DevTools check document.contentType before injecting (#17739)
It should only inject the global hook into HTML documents. This will avoid breaking syntax highlighting for e.g. XML documents.
2019-12-29 13:02:50 -08:00
Brian Vaughn
0eac01abcd Added missing Flow type coverage to DevTools context menu (#17733)
The  param should probably be a generic type, but I'm not sure how to satisfy Flow with the current top-level  Map. At least this adds basic coverage (which was missing before, oops).
2019-12-29 08:44:24 -08:00
Brian Vaughn
f887d1aa27 [DevTools] Display RegExp values in props/state (#17690)
Previously, when props/state contained a regexp, it was shown as an
empty object. This commit adds regexps as values in need of special
rehydration (like Symbols or TypedArrays), and display them as a user
might expect.

Co-authored-by: Zirak <zirakertan@gmail.com>
2019-12-22 11:49:28 -08:00
Brian Vaughn
1959671d45 Add tooltip to interaction name in DevTools Profiler sidebar (#17689) 2019-12-22 08:52:53 -08:00
Nick S. Plekhanov
ccc6100d7f Fix comments typos (#17550)
* Fix comments typos

* Fix comments typos

* Fix more typos

Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2019-12-22 08:44:34 -08:00
Maxime Bouveron
6215e1c2db Add Shift+Enter to go to previous search result (#17005) 2019-12-22 08:38:14 -08:00
Dominic Gannaway
85d9655d6f [react-dom] Refactor event priority handling to its own module (#17678) 2019-12-20 23:15:36 +00:00
Brian Vaughn
3e09677836 DevTools v4.2.1 -> 4.3.0 2019-12-20 09:11:37 -08:00
Nicolas Gallagher
31350237fa Add unit tests to dom-event-testing-library (#17680)
Unit tests for the simple event mocks
2019-12-20 16:35:02 +00:00
Brian Vaughn
79734771cd Disable "copy to clipboard" and "go to definition" context menu options for Firefox addon (#17668) 2019-12-20 08:31:38 -08:00
Dominic Gannaway
dbc46ac63e [react-interactions] Rename test + fix master (#17679) 2019-12-20 16:00:39 +00:00
Brian Vaughn
1b9328cd9b Null stateNode after unmount (#17666) 2019-12-19 13:32:14 -08:00
Dan Abramov
897976600c [ESLint] Allow partial matches for custom Effect Hooks (#17663) 2019-12-19 17:04:17 +00:00
Nicolas Gallagher
72592310a8 Create packages/dom-event-testing-library (#17660)
Moves the unit testing library for events into the `packages` directory so it can more easily be used in tests for other react packages, and mirrored internally to help with testing of event hooks we prototype in www.
2019-12-19 16:51:25 +00:00
Dominic Gannaway
e7494c86c5 [react-interactions] Remove batchedUpdates from responder lifecycles (#17659) 2019-12-19 13:07:00 +00:00
Nicolas Gallagher
a5e951d4cc [react-interactions] Event testing library improvements (#17614)
Introduces a state machine around pointer events to produce more accurate mock
touch events. This allows multi-touch unit tests to be written entirely in
terms of mock pointer interactions, while producing the expected
'changedTouches', 'targetTouches', and 'touches' fields for mock touch events.
2019-12-18 23:32:48 +00:00
Brian Vaughn
95056b6836 DevTools build script enhancements (#17653)
* Updated DevTools local development instructions to mention experimental build step

* Added a command to download latest experimental release (for DevTools)

* Updated build instructions for clarity

* Added build-for-devtools package alias
2019-12-18 14:34:40 -08:00
Brian Vaughn
fd2a3ae57f Updated DevTools changelog 2019-12-18 12:51:18 -08:00
Brian Vaughn
933f6a07ca DevTools context menu (#17608)
* Added rudimentary context menu hook and menu UI

* Added backend support for copying a value at a specific path for the inspected element

* Added backend support for storing a value (at a specified path) as a global variable

* Added special casing to enable copying undefined/unserializable values to the clipboard

* Added copy and store-as-global context menu options to selected element props panel

* Store global variables separately, with auto-incremented name (like browsers do)

* Added tests for new copy and store-as-global backend functions

* Fixed some ownerDocument/contentWindow edge cases

* Refactored context menu to support dynamic options

Used this mechanism to add a conditional menu option for inspecting the current value (if it's a function)

* Renamed "safeSerialize" to "serializeToString" and added inline comment
2019-12-18 12:12:34 -08:00
Sebastian Markbåge
7dc9745427 [Flight] Chunks API (#17398)
* Add feature flags

* Add Chunk type and constructor

* Wire up Chunk support in the reconciler

* Update reconciler to reconcile Chunks against the render method

This allows the query and args to be updated.

* Drop the ref. Chunks cannot have refs anyway.

* Add Chunk checks in more missing cases

* Rename secondArg

* Add test and fix lazy chunks

Not really a supported use case but for consistency I guess.

* Fix fragment test
2019-12-18 18:25:43 +00:00
Eli White
9354dd2752 Make HostComponent inexact (#17412) 2019-12-18 18:21:42 +00:00
Sebastian Markbåge
4c270375e9 Favor fallthrough switch instead of case statements for work tags (#17648)
* Favor fallthrough switch instead of case statements for work tags

Currently we're inconsistently handling tags that are only relevant
for certain flags. We should throw if the tag is not part of the built
feature flags. This should also mean that the case statements can be
eliminated.

We can achieve this effect by putting the invariant outside of the switch
and always early return in the switch. We already do this in beginWork.
This PR makes this consistent in other places.

* Fail if fundamental/scope tags are discovered without the flag on
2019-12-18 15:53:27 +00:00
Dan Abramov
6fef7c47a9 Add a regression test for switching from Fragment to a component (#17647)
* Add a regression test for switching from Fragment to a component

* Add a few more tests
2019-12-18 15:21:42 +00:00
Dominic Gannaway
9fe1031244 [react-interactions] Rename Flare APIs to deprecated and remove from RN (#17644) 2019-12-18 10:24:46 +00:00
Brian Vaughn
e84327ba0c Added more forwardRef test cases for DevTools (#17642) 2019-12-17 12:45:10 -08:00
Dan Abramov
4b0cdf29a8 Build FB RN targets only in experimental mode (#17641) 2019-12-17 20:22:49 +00:00
zthxxx
24dbe851e8 fix(dev-tools): fix show correct displayName with forwardRef in Dev Tools (#17613)
* fix(dev-tools): fix show correct displayName with forwardRef in Dev Tools

allow set `displayName` after `React.forwardRef()`,
makesure Dev Tools show displayName as same as `getWrappedName` in `shared/getComponentName.js`

* Removed a little unnecessary/redundant code.

* Fixed lint error (removed unused var)
2019-12-17 11:29:16 -08:00
Brian Vaughn
bb75a4fa89 Improved selection and toggling for props/hooks/state (#17588)
1. Enable nested values to be expanded/collapsed by clicking on values as well as keys.
2. Enable keys and values to be selectable (for copy-pasting purposes)
2019-12-17 11:28:37 -08:00
伊撒尔
7309c5f934 Use zero-fill right shift instead of Math.floor (#17616)
For positive numbers, binary displacement is better.
2019-12-17 11:16:04 -08:00
Dan Abramov
9bb3fbe893 Move DevTools CI job to experimental workflow (#17640) 2019-12-17 18:21:38 +00:00
Dan Abramov
3c54df0914 Fix missing stacks in WWW warnings (#17638) 2019-12-17 15:21:18 +00:00
Dan Abramov
b66e86d957 react-refresh@0.7.1 2019-12-17 13:50:57 +00:00
Dan Abramov
c2d1561c60 [Fast Refresh] Support injecting runtime after renderer executes (#17633) 2019-12-17 13:49:39 +00:00
Dan Abramov
0253ee9a2e Additional test infra changes for toErrorDev rename (#17632) 2019-12-17 13:31:47 +00:00
Dan Abramov
36a6e29bb3 Fix test_build_devtools CI job to run test-build-devtools (#17631)
* Skip abandoned project folders in Jest config

This fixes a problem that occurs after renaming a package.

* Fix test_build_devtools to run test-build-devtools

* Exclude console.error plugin for DevTools packages

* Use correct release channel for DevTools tests

This should fix the createRoot error.

* Fix TZ dependent test

* Change DT job dependencies
2019-12-16 16:03:12 -08:00
Dan Abramov
7c21bf72ac Fix release script to ignore empty package folders 2019-12-16 19:16:58 +00:00
Dan Abramov
f42431abe1 Revert "Remove renderPhaseUpdates Map (#17484)" (#17623)
This reverts commit 8a347ed024.
2019-12-16 19:03:00 +00:00
Dan Abramov
0b5a26a489 Rename toWarnDev -> toErrorDev, toLowPriorityWarnDev -> toWarnDev (#17605)
* Rename toWarnDev -> toErrorDev in tests

* Rename toWarnDev matcher implementation to toErrorDev

* Rename toLowPriorityWarnDev -> toWarnDev in tests and implementation
2019-12-16 12:48:16 +00:00
Dan Abramov
0cf22a56a1 Use console directly instead of warning() modules (#17599)
* Replace all warning/lowPriWarning with console calls

* Replace console.warn/error with a custom wrapper at build time

* Fail the build for console.error/warn() where we can't read the stack
2019-12-14 18:09:25 +00:00
Dan Abramov
b6c423daad Use matching test command for equivalence tests (#17604) 2019-12-14 17:52:29 +00:00
Sebastian Markbåge
8a347ed024 Remove renderPhaseUpdates Map (#17484)
* Render phase updates can now be extracted from the pending queue

* Use a custom dispatcher for the second render pass

* Discard render phase updates if component throws

When aborting a render, we also need to throw out render phase updates.
Remove the updates from the queues so they do not persist to the next
render. We already did a single pass through the whole list of hooks, so
we know that any pending updates must have been dispatched during the
render phase. The ones that were dispatched before we started rendering
were already transferred to the current hook's queue.
2019-12-13 16:45:09 -08:00
Dominic Gannaway
be603f5a51 [react-events] Remove lastNativeEvent in favor of SystemFlags (#17585) 2019-12-13 17:03:35 +00:00
Dan Abramov
b15bf36750 Add component stacks to (almost) all warnings (#17586) 2019-12-12 23:47:55 +00:00
Nicolas Gallagher
612a76812f [react-interactions] Mock touchend events should use empty array for 'touches' (#17589)
The 'touches' value should be an empty array rather than 'null'
2019-12-12 22:21:30 +00:00
Brian Vaughn
12c000412d Improved inspected element props with inline previews (#17579)
* Improved inspected element props with inline previews

This mimics the inline preview shown by the brower console and dramatically improves the UX when inspecting deep values. I also updated tests to add more coverage for this new functionality.

* Cleaned up the DataView vs typed array check

* Added early bailouts to DevTools when generating preview strings for iterables/objects/arrays, to avoid doing unnecessary work
2019-12-11 17:52:17 -08:00
Dominic Gannaway
2afeebdcc4 [react-interactions] Remove responder root event types + revert commit phase change (#17577) 2019-12-11 16:48:46 +00:00
Laura buns
9ac42dd074 Remove the condition argument from warning() (#17568)
* prep for codemod

* prep warnings

* rename lint rules

* codemod for ifs

* shim www functions

* Handle more cases in the transform

* Thanks De Morgan

* Run the codemod

* Delete the transform

* Fix up confusing conditions manually

* Fix up www shims to match expected API

* Also check for low-pri warning in the lint rule
2019-12-11 03:28:14 +00:00
Andrew Clark
7bf40e1cfd Initialize update queue object on mount (#17560)
* Refactor Update Queues to Fix Rebasing Bug

Fixes a bug related to rebasing updates. Once an update has committed,
it should never un-commit, even if interrupted by a higher priority
update. The fix includes a refactor of how update queues work.

This commit is a combination of two PRs:

- #17483 by @sebmarkbage refactors the hook update queue
- #17510 by @acdlite refactors the class and root update queue

Landing one without the other would cause state updates to sometimes be
inconsistent across components, so I've combined them into a single
commit in case they need to be reverted.

Co-authored-by: Sebastian Markbåge <sema@fb.com>
Co-authored-by: Andrew Clark <git@andrewclark.io>

* Initialize update queue object on mount

Instead of lazily initializing update queue objects on the first update,
class and host root queues are created on mount. This simplifies the
logic for appending new updates and matches what we do for hooks.
2019-12-10 18:42:42 -06:00
Brian Vaughn
031a5aaffb Show component location for selected element in bottom/right of props panel (#17567)
* Show component location info for selected element in bottom/right of props panel

* Moved RegExp declaration into function basedon PR feedback
2019-12-10 09:24:34 -08:00
Andrew Clark
e039e690b5 Revert Update Queue Refactor
Reverts b617db3d96.

Found some bugs when attempting to land in www. Reverting to fix master.
I'll land again *after* the change successfully land downstream.
2019-12-09 15:16:09 -08:00
Andrew Clark
b617db3d96 Refactor Update Queues to Fix Rebasing Bug
Fixes a bug related to rebasing updates. Once an update has committed,
it should never un-commit, even if interrupted by a higher priority
update. The fix includes a refactor of how update queues work.

This commit is a combination of two PRs:

- #17483 by @sebmarkbage refactors the hook update queue
- #17510 by @acdlite refactors the class and root update queue

Landing one without the other would cause state updates to sometimes be
inconsistent across components, so I've combined them into a single
commit in case they need to be reverted.

Co-authored-by: Sebastian Markbåge <sema@fb.com>
Co-authored-by: Andrew Clark <git@andrewclark.io>
2019-12-09 13:19:26 -08:00
Dominic Gannaway
3c1efa0d77 [react-interactions] Remove Focus/FocusWithin root event types (#17555) 2019-12-09 14:27:45 +00:00
Nicolas Gallagher
9e937e7e86 [react-interactions] fix Press/Tap behavior for virtual middle clicks (#17554)
Tools like BetterTouchTool for macOS trigger middle-clicks with a 'buttons'
value that doesn't correspond to the middle-mouse button. To account for this
we also inspect the value of 'button'.

Close #17367
2019-12-09 13:04:24 +00:00
Laura buns
b43eec7eaa Replace wrap-warning-with-env-check with an eslint plugin (#17540)
* Replace Babel plugin with an ESLint plugin

* Fix ESLint rule violations

* Move shared conditions higher

* Test formatting nits

* Tweak ESLint rule

* Bugfix: inside else branch, 'if' tests are not satisfactory

* Use a stricter check for exactly if (__DEV__)

This makes it easier to see what's going on and matches dominant style in the codebase.

* Fix remaining files after stricter check
2019-12-06 18:25:54 +00:00
Dominic Gannaway
acfe4b21b2 [react-interactions] Upgrade passive event listeners to active listeners (#17513) 2019-12-04 19:30:50 +00:00
Farhad Yasir
5235d193d7 fix: make serializable data in react-devtools (#17233)
* fix: make serializable data for bridge in react-devtools

* fix: add bigint data type in hydration

* refactor: remove console.log

* test: update unit tests for bigint in react-devtools
2019-12-04 15:53:00 +00:00
Sebastian Markbåge
5064c7f6aa Revert Rerender Error Check (#17519)
* Add failing test

* Revert "Move rerender error check to avoid global state"

This reverts commit 3e77742d8c4e64b89f816c0b1ce0bc156f8c5f61.
2019-12-03 23:10:36 -08:00
Dominic Gannaway
6d105ad3f6 [react-interactions] Move Flare event registration to commit phase (#17518) 2019-12-04 02:08:20 +00:00
Sebastian Markbåge
dc18b8b8d2 Don't group Idle/Offscreen work with other work (#17456)
When we suspend we always try a lower level but we shouldn't try offscreen.
2019-12-03 13:38:02 -08:00
Sebastian Markbåge
f523b2e0d3 Use fewer global variables in Hooks (#17480)
* We don't need the global state for this

* Move componentUpdateQueue and sideEffectTag out of global state

* Move firstWorkInProgressHook off global state

* Move remainingExpirationTime off global state

* Reset fiber to its current state if it throws

* Move rerender error check to avoid global state

This means that it's harder to find it since it's not in the dispatch
function's stack but we can add a DEV only one for that if we really
need it. Alternatively, we can check it in against the renderUpdates queue.

* Move next___Hook out of global state

* Assert that currentlyRenderingFiber is always set

When accessed, this should always be set. This could enforced by storing
this on the dispatcher for example.

* Add another test just to be safe
2019-12-03 12:51:36 -08:00
Sebastian Markbåge
d75323f65d Remove case that only exists for createBatch (#17506)
The comment says this is only needed for createBatch().commit() which
doesn't exist anymore.
2019-12-03 10:35:17 -08:00
Sebastian Markbåge
79572e34d1 Adjust SuspenseList CPU bound heuristic (#17455)
* Adjust SuspenseList CPU bound heuristic

In SuspenseList we switch to rendering fallbacks (or stop rendering further
rows in the case of tail="collapsed/hidden") if it takes more than 500ms
to render the list. The limit of 500ms is similar to the train model and
designed to be short enough to be in the not noticeable range.

This works well if each row is small because we time the 500ms range well.
However, if we have a few large rows then we're likely to exceed the limit
by a lot. E.g. two 480ms rows hits almost a second instead of 500ms.

This PR adjusts the heuristic to instead compute whether something has
expired based on the render time of the last row. I.e. if we think rendering
one more row would exceed the timeout, then we don't attempt.

This still works well for small rows and bails earlier for large rows.

The expiration is still based on the start of the list rather than the
start of the render. It should probably be based on the start of the render
but that's a bigger change and needs some thought.

* Comment
2019-12-02 17:53:08 -08:00
Sung M. Kim
b64938e123 Fixed changelog formatting #17481 (#17487) 2019-11-29 13:57:38 +00:00
Dan Abramov
969f4b5bb8 Change DevTools hook warning message (#17478) 2019-11-28 00:47:13 +00:00
Brian Vaughn
3816ae7c38 DevTools version bump 4.2.0 -> 4.2.1 2019-11-27 07:49:49 -08:00
Brian Vaughn
5fc97420b9 Remove dependency on local git checkout from build process (#17475)
* Remove dependency on local git checkout from build process

* Updated Webpack dependencies to account for recent changes to deps for Flight
2019-11-27 07:48:09 -08:00
Dan Abramov
6470e0f169 [Fresh] Make all errors recoverable (#17438)
* [Fresh] Detect root updates more reliably

* [Fresh] Use WeakMap for root elements

* [Fresh] Make initial failures recoverable too

* Fix DevTools check

* Fix wrong flow type
2019-11-25 17:25:34 +00:00
Andrew Clark
54f66731c8 Update release script URL (#17428)
CircleCI API endpoint changed
2019-11-21 13:19:03 -08:00
Dan Abramov
237a966da0 [Fresh] Fix an infinite loop in an edge case (#17414)
* [Fresh] Fix an infinite loop in an edge case

* Make it work in IE11
2019-11-21 14:10:26 +00:00
Dominic Gannaway
007a276b65 [react-interactions] Fix memory leak in event responder system (#17421) 2019-11-21 13:15:37 +00:00
Dominic Gannaway
3fdfa231ad [react-interactions] Refine virtual click detection for FF+JAWS/NVDA (#17422) 2019-11-21 13:09:30 +00:00
Dominic Gannaway
a7d07ff24d [react-interactions] Rename Flare listeners prop to DEPRECATED_flareListeners (#17394) 2019-11-18 13:32:50 +00:00
Sebastian Markbåge
3ad076472c Update Fixtures to use new APIs (#17380)
Also renamed unstable-async to concurrent
2019-11-17 14:42:47 -08:00
Andrew Clark
1f2da0babd Forgot to mark test as experimental (#17391) 2019-11-17 13:59:25 -08:00
David Garner
a807c307c4 [eslint] Check forwardRef callbacks (#17255)
* [eslint] Check forwardRef callbacks (#17220)

* [eslint] Make tests more realistic (#17220)

* [eslint] Check anonymous callback of React.memo for rules-of-hooks (#17220)

* [eslint] Add tests for callbacks not known to be components (#17220)

* [eslint] Correct comments and add another test (#17220)
2019-11-17 13:39:08 +00:00
Andrew Clark
2586303662 [Bugfix] Pending state is always user-blocking (#17382)
Fixes a bug where `isPending` is only set to `true` if `startTransition`
is called from inside an input event. That's usually the case, but
not always.

Now it works regardless of where you call it.
2019-11-15 15:46:09 -08:00
Sebastian Markbåge
8e74a31b2d Add Webpack as devDependency (#17379)
This is now used by the Flight package so it needs to be installed as a
peer.
2019-11-15 14:02:59 -08:00
Sebastian Markbåge
39dbb14da3 [Flight] Move Flight DOM to a Webpack Specific Package (#17372)
* Move Flight DOM to Webpack Specific Packagee

We'll have Webpack specific coupling so we need to ensure that it can be
versioned separately from various Webpack versions. We'll also have builds
for other bundlers in the future.

* Move to peerDep

* Move DOM Flight Tests

* Merge ReactFlightIntegration into ReactFlightDOM

This was an integration test. We can add to it.

* Fix fixture paths
2019-11-15 11:46:07 -08:00
Dominic Gannaway
532810a370 [react-interactions] FocusWithin beforeblur propagation fix (#17375) 2019-11-15 12:05:00 +00:00
Dominic Gannaway
f30ccb9ed9 [react-interactions] Fix unatached fiber bug (#17371) 2019-11-15 00:47:33 +00:00
Luna Ruan
1832f832c5 Changelog for 16.12 2019-11-14 16:06:10 -08:00
Luna Ruan
9a5f28dbed update version numbers for 16.12 2019-11-14 16:02:18 -08:00
Ricky
769dd522a2 [Fast Refresh] Fix for intentional unmounts after an error (#17368) 2019-11-14 18:40:25 +00:00
Dominic Gannaway
df8db4e005 [react-interactions] Enable event system before dispatching blur (#17365) 2019-11-14 13:47:39 +00:00
Dominic Gannaway
fc43644eba [react-interactions] Follow up active element blur logic (#17364) 2019-11-14 11:55:50 +00:00
Dominic Gannaway
a61886b16b [react-interactions] Refine custom active element blur logic (#17354) 2019-11-13 20:46:00 +00:00
Andrew Clark
b53ea6ca05 [Bugfix] Passive effects triggered by synchronous renders in a multi-root app (#17347)
* Regression test: Effects dropped across roots

See #17066

* [Bugfix] Passive effects loop

The bug
-------

In a multi-root app, certain passive effects (`useEffect`) are never
fired. See #17066.

The underlying problem
----------------------

The implicit contract of `flushPassiveEffects` is that, right after
calling it, there should be no pending passive effects. In the normal
case, in concurrent mode, this is true. But the current implementation
fails to account for the case where a passive effect schedules
synchronous work, which in turn schedules additional passive effects.

This led to `rootWithPendingPassiveEffects` being overwritten in the
commit phase, because an assignment that assumed it was replacing null
was actually replacing a reference to another root, which has the
consequence of dropping passive effects on that root.

The fix
-------

The fix I've chosen here is, at the beginning of the commit phase, keep
flushing passive effects in a loop until there are no more.

This doesn't not change the "public" implementation of
`flushPassiveEffects`, though it arguably should work this way, too. I
say "public" because it's only used by implementation layers on top of
React which we control: mainly, the legacy version of `act` that does
not use the mock Scheduler build. So there's probably still a bug
in that `act` implementation.

I will address `act` in a follow-up. The ideal solution is to replace
the legacy `act` with one implemented directly in the renderer, using a
special testing-only build of React DOM. Since that requires a breaking
change, we'll need an interim solution. We could make the "public" `act`
recursively flush effects in a loop, as I've done for the commit phase.
However, I think a better solution is to stop automatically flushing the
synchronous update queue at the end of `flushPassiveEffects`, and
instead require the caller to explicitly call `flushSyncUpdateQueue` (or
the equivalent) if needed. This follows the same pattern we use
internally in the work loop, which is designed to avoid factoring
hazards like the one that resulted in this bug.
2019-11-12 10:41:07 -08:00
Vasilii Cuhar
f4cc45ce96 [Fresh] Add options to configure RefreshSig and RefreshReg identifiers (#17340) 2019-11-12 14:16:23 +00:00
Eli White
ade764157f [Native] If statement cleanup for null targets (#17346) 2019-11-11 12:58:30 -08:00
Eli White
3dcec3a925 [Native] Add FeatureFlag to dispatch events with instance currentTarget (#17345)
* [Native] Add FeatureFlag to dispatch events with instance targets

* Prettier

* [Native] Change currentTarget to be an instance behind a flag 2/2
2019-11-11 12:42:06 -08:00
Eli White
2c6ea0b3ff [Native] Add FeatureFlag to dispatch events with instance targets (#17323)
* [Native] Add FeatureFlag to dispatch events with instance targets

* Prettier
2019-11-11 11:35:29 -08:00
Eli White
01bce8c248 Change legacy-events plugin nativeEventTarget to allow null (#17344) 2019-11-11 11:22:41 -08:00
Dominic Gannaway
6cff70a740 [react-interactions] Expost host instance to Scope Query function (#17341) 2019-11-11 13:51:46 +00:00
Dan Abramov
b8f8258775 Split ReactDOM entry point (#17331)
* Split ReactDOM entry point

* BatchedRoot -> BlockingRoot
2019-11-10 13:43:29 +00:00
Dan Abramov
a7b4d51a20 Warn when doing createRoot twice on the same node (another approach) (#17329)
* Unify fields used for createRoot warning and event system

* Warn when doing createRoot twice on the same node

* Stricter check for modern roots

* Unmark asynchronously

* Fix Flow
2019-11-10 00:54:13 +00:00
Dan Abramov
be3bfa6fab [Flight] Basic Integration Test (#17307)
* [Flight] Basic Integration Test

* Just act()

* Lint

* Remove unnecessary acts

* Use Concurrent Mode

* it.experimental

* Fix prod test by advancing time

* Don't observe initial state
2019-11-09 02:56:03 +00:00
Dan Abramov
182f64f938 [Flight] End-to-End Fixture (#17319) 2019-11-09 02:44:27 +00:00
Dan Abramov
6cb6b1d668 Add yarn build --unsafe-partial (#17316)
* Add yarn build --partial

* unsafe-partial
2019-11-08 19:41:40 +00:00
Moti Zilberman
38dd17ab98 [RN] Hoist static deepDiffer options object (#17303) 2019-11-07 16:03:55 +00:00
Moti Zilberman
61d3dd0e08 Update deepDiffer usage in React Native renderer (#17282)
* Add RN prop diffing test with function values

* Update RN deepDiffer mock

* Explicitly ignore functions in RN prop differ
2019-11-07 04:00:20 -08:00
Dominic Gannaway
e701632ad4 [react-interactions] Change unmount blur logic to a dedicated event (#17291) 2019-11-07 10:27:02 +00:00
Dominic Gannaway
ce4b3e9981 [react-interactions] Add optional searchNodes to Scope.queryAllNodes (#17293) 2019-11-06 22:52:59 +00:00
Sebastian Markbåge
dee03049f5 [Flight] Basic Streaming Suspense Support (#17285)
* Return whether to keep flowing in Host config

* Emit basic chunk based streaming in the Flight server

When something suspends a new chunk is created.

* Add reentrancy check

The WHATWG API is designed to be pulled recursively.

We should refactor to favor that approach.

* Basic streaming Suspense support on the client

* Add basic suspense in example

* Add comment describing the protocol that the server generates
2019-11-06 09:48:34 -08:00
Dan Abramov
f50f39b55f [Flight] Better compat with http.createServer (#17289) 2019-11-06 17:10:26 +00:00
Brian Vaughn
3452706308 DevTools cleanup (#17283)
1. Add a Store test for memo, lazy, and forwardRef components
2. Remove dead code for React.lazy
3. Update DT tests to include HOC badge names in the serialized store
2019-11-05 22:19:10 -08:00
Dominic Gannaway
cd1bdcd067 [react-interactions] Prevent duplicate onPress firing for keyboard Enter (#17266)
* [react-interactions] Prevent duplicate onPress firing for keyboard Enter

* address feedback
2019-11-05 23:28:26 +00:00
Waseem Dahman
4f02c93c7c Fix devtools displaying Anonymous for memo of ref-forwarding components (#17274)
* [react-is] return correct typeOf value of forwardRef

* [react-devtools-shared] use correct displayName of memo(forwardRef(Component))

* [react-devtools-shared] add resolveFiberType and resolve fiber type of memo recursively

Resolving the fiber type of memo recursively before passing it to getDisplayName
will prevent it from displaying "Anonymous" as displayName for components
wrapped with both memo and forwardRef: memo(forwardRef(Component))

* rework resolveFiberType
2019-11-05 14:08:01 -08:00
Brian Vaughn
053cf0fedc Fix react-is memo and lazy type checks (#17278) 2019-11-05 10:37:12 -08:00
Andrew Clark
0f3838a01b Remove debugRenderPhaseSideEffects flag (#17270)
There are two similar flags, `debugRenderPhaseSideEffects` and
`debugRenderPhaseSideEffectsForStrictMode`. The strict mode one is the
only one that is actually used. I think originally the theory is that
we would one day turn it on for all components, even outside strict
mode. But what we'll do instead is migrate everyone to strict mode.

The only place `debugRenderPhaseSideEffects` was being used was in
an internal test file. I rewrote those tests to use public APIs.
2019-11-04 14:07:05 -08:00
Dominic Gannaway
cb09dbe0ab [react-interactions] Add handleSimulateChildBlur upon DOM node removal (#17225)
* [react-interactions] Add handleSimulateChildBlur upon DOM node removal
2019-11-04 20:02:45 +00:00
Eli White
6095993d46 Types: findHostInstance_DEPRECATED returns React.ElementRef<HostComponent<mixed>> (#17265)
* Types: findHostInstance_DEPRECATED returns React.ElementRef<HostComponent<mixed>>

* Prettier
2019-11-04 10:14:01 -08:00
Mateusz Burzyński
62ef25077e Avoid bundling in ponyfill for Object.assign in use-subscription package (#17259) 2019-11-04 07:33:10 -08:00
Sebastian Markbåge
f4148b2561 [Flight] Move around the Server side a bit (#17251)
* Rename ReactFlightStreamer -> ReactFlightServer

* Unify Browser/Node stream tests into one file and use the client reader

* Defer to the actual ReactDOM for HTML rendering for now

This will need to use a variant of Fizz to do inline SSR in Flight.
However, I don't want to build the whole impl right now but also don't
want to exclude the use case yet. So I outsource it to the existing
renderer. Ofc, this doesn't work with Suspense atm.
2019-11-01 17:39:24 -07:00
Sebastian Markbåge
fadc97167f [Flight] Add Client Infrastructure (#17234)
* Change demo to server

* Expose client in package.json

* Reorganize tests

We don't want unit tests but instead test how both server and clients work
together. So this merges server/client test files.

* Fill in the client implementation a bit

* Use new client in fixture

* Add Promise/Uint8Array to lint rule

I'll probably end up deleting these deps later but they're here for now.
2019-11-01 16:05:07 -07:00
Brian Vaughn
36fd29f09f Don't show empty (no work) commits in Profiler (#17253) 2019-11-01 15:51:39 -07:00
Andrew Clark
a2e05b6c14 [Scheduler] Delete old rAF implementation (#17252)
We've been using the message loop version for a while. Time to delete.
2019-11-01 13:32:22 -07:00
Andrew Clark
6dc2734b41 Codemod tests to it.experimental (#17243)
`it.experimental` marks that a test only works in Experimental builds.

It also asserts that a test does *not* work in the stable builds. The
main benefit is that we're less likely to accidentally expose an
experimental API before we intend. It also forces us to un- mark an
experimental test once it become stable.
2019-11-01 10:20:08 -07:00
Ives van Hoorne
a1ff9fd7bb Add CodeSandbox CI Config (#17175)
* Add CodeSandbox CI Config

* Add default sandbox to build

* Make build more efficient and add scheduler

* Force build

* Add scheduler image

* Add scheduler/tracing to the build

* Force another build
2019-10-31 10:44:48 -07:00
Brian Vaughn
273679a78c 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
Eli White
d0fc0ba0a6 Revert "Dispatch commands to both UIManagers from both renderers (#17211)" (#17232)
This reverts commit 8eee0eb01c.
2019-10-30 18:03:37 -07:00
Eli White
bdcdb69a24 Rename findHostInstance_deprecated to findHostInstance_DEPRECATED (#17228) 2019-10-30 13:10:16 -07:00
Eli White
515746c217 Add findHostInstance_deprecated to the React Native Renderer (#17224) 2019-10-30 11:42:37 -07:00
Brian Vaughn
9a35adc96d Only call Profiler onRender when a descendant had work (#17223) 2019-10-30 11:08:42 -07:00
Eli White
8eee0eb01c Dispatch commands to both UIManagers from both renderers (#17211)
* Dispatch commands to both UIManagers from both renderers

* Merge test files
2019-10-29 18:16:23 -07:00
Sebastian Markbåge
f4e974d26e Add Experimental Flight Infrastructure (#16398)
* Add Flight Build and Unify HostFormat Config between Flight and Fizz

* Add basic resolution of models

* Add basic Flight fixture

Demonstrates the streaming protocol.

* Rename to flight-server to distinguish from the client parts

* Add Flight Client package and entry point

* Fix fixture
2019-10-29 14:45:47 -07:00
Sebastian Markbåge
6cd365cac6 Don't treat the last row in hidden as deleted if already mounted (#17206)
Already mounted rows that resuspend may be considered as part of a tail
if they're at the end. However, for purposes of the tail="..." option
they don't get deleted. We deal with that in cutOffTailIfNeeded.

However, if they're also the first to suspend in the "hidden" case, we have
a special case that deletes the actual rendered row. This needs to consider
if that row was already mounted or things go wrong.
2019-10-29 13:38:25 -07:00
Dominic Gannaway
048879edad [react-interactions] Ensure props on scope query function is always object (#17212) 2019-10-29 13:26:46 -07:00
Brian Vaughn
3497ccc149 Add guard to handle modified React elements with non-string keys (#17164) 2019-10-29 08:41:48 -07:00
Lea Rosema
0f64703edf Update .mailmap (#17177) 2019-10-28 16:48:54 +00:00
Deniz Susman
3f9c036758 Typo fix in comment (#17111) 2019-10-26 08:33:05 -07:00
Dan Abramov
f6b8d31a76 Rename createSyncRoot to createBlockingRoot (#17165)
* Rename createSyncRoot to createBlockingRoot

* Fix up
2019-10-23 15:04:39 -07:00
Wilco Fiers
9c02d26549 docs: Fixed a typo in readme.md (#17119) 2019-10-23 18:52:14 +01:00
Andrew Clark
57b2fbb741 Changelog for 16.11.0 2019-10-22 14:30:12 -07:00
Andrew Clark
8075c8505b Update local package versions for 16.10 release 2019-10-22 14:30:06 -07:00
Brian Vaughn
5faf377df5 Fixed a style bug in props editor (#17162) 2019-10-21 15:08:55 -07:00
Dominic Gannaway
f7ec65eeba [react-interactions] Make events non-passive to allow preventDefault (#17136) 2019-10-21 22:37:27 +02:00
Andrew Clark
1022ee0ec1 Read current time without marking event start time (#17160)
* Failing test: DevTools hook freezes timeline

The DevTools hook calls `requestCurrentTime` after the commit phase has
ended, which has the accidnental consequence of freezing the start
time for subsequent updates. If enough time goes by, the next update
will instantly expire.

I'll push a fix in the next commit.

* Read current time without marking event start time

`requestCurrentTime` is only meant to be used for updates, because
subsequent calls within the same event will receive the same time.
Messing this up has bad consequences.

I renamed it to `requestCurrentTimeForUpdate` and created a new
function that returns the current time without the batching heuristic,
called `getCurrentTime`.

Swapping `requestCurrentTime` for `getCurrentTime` in the DevTools
hook fixes the regression test added in the previous commit.
2019-10-21 13:15:37 -07:00
Andrew Clark
349cf5acc3 Experimental test helper: it.experimental (#17149)
Special version of Jest's `it` for experimental tests. Tests marked as
experimental will run **both** stable and experimental modes. In
experimental mode, they work the same as the normal Jest methods. In
stable mode, they are **expected to fail**. This means we can detect
when a test previously marked as experimental can be un-marked when the
feature becomes stable. It also reduces the chances that we accidentally
add experimental APIs to the stable builds before we intend.

I added corresponding methods for the focus and skip APIs:

- `fit` -> `fit.experimental`
- `it.only` -> `it.only.experimental` or `it.experimental.only`
- `xit` -> `xit.experimental`
- `it.skip` -> `it.skip.experimental` or `it.experimental.skip`

Since `it` is an alias of `test`, `test.experimental` works, too.
2019-10-19 16:08:08 -07:00
Andrew Clark
edc234c730 Build script should default to experimental (#17144)
`yarn build` defaults to building in experimental mode. To opt-out, set
the `RELEASE_CHANNEL` environment variable to `stable`. This is the same
as what we do when running tests via `yarn test`, to make local
development easier.
2019-10-18 19:35:33 -07:00
Sebastian Markbåge
3cc564547c SuspenseList support in DevTools (#17145)
* SuspenseList support in DevTools

This adds SuspenseList tags to DevTools so that the name properly shows
up.

It also switches to use the tag instead of Symbol type for Suspense
components. We shouldn't rely on the type for any built-ins since that
field will disappear from the fibers. How the Fibers get created is an
implementation detail that can change e.g. with a compiler or if we
use instanceof checks that are faster than symbol comparisons.

* Add SuspenseList test to shell app
2019-10-18 17:18:36 -07:00
Sebastian Markbåge
68fb58029d 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
Andrew Clark
3059ab3523 Add experimental instructions to release README (#17143) 2019-10-18 16:26:06 -07:00
Andrew Clark
093de5fb43 Lint experimental build artifacts (#17141)
Adds `lint_build` job to the experimental workflow
2019-10-18 16:03:08 -07:00
Andrew Clark
7082d5a2db Don't build non-experimental www bundles (#17139)
Reduces the likelihood we'll accidentally sync the wrong ones.
2019-10-18 14:36:59 -07:00
Andrew Clark
c47f59331e Move SuspenseList to experimental package (#17130)
Also moves `withSuspenseConfig`
2019-10-18 14:24:13 -07:00
Luna Ruan
685ed561f2 Migrate useDeferredValue and useTransition (#17058)
Migrated useDeferredValue and useTransition from Facebook's www repo into ReactFiberHooks.
2019-10-18 12:48:43 -07:00
Dan Abramov
0b61e26983 Update RN typings for a shim (#17138) 2019-10-18 18:05:09 +01:00
Sebastian Markbåge
4eeee358e1 [SuspenseList] Store lastEffect before rendering (#17131)
* Add a failing test for SuspenseList bug

* Store lastEffect before rendering

We can't reset the effect list to null because we don't rereconcile the
children so we drop deletion effects if we do that.

Instead we store the last effect as it was before we started rendering
so we can go back to where it was when we reset it.

We actually already do something like this when we delete the last row
for the tail="hidden" mode so we had a field available for it already.
2019-10-17 15:57:07 -07:00
Nicolas Gallagher
4fb5bf61dd [react-interactions] Fix focus-visible heuristic (#17124)
Respond to all keys not just `Tab`
2019-10-17 09:24:31 -07:00
Dominic Gannaway
8facc05373 [react-interactions] Allow event.preventDefault on LegacyPress responder (#17113)
[react-interactions] Allow event.preventDefault on LegacyPress responder
2019-10-17 10:21:02 +02:00
Andrew Clark
7cec15155a Remove prefixed concurrent APIs from www build (#17108)
The downstream callers have been updated, so we can remove these.
2019-10-16 18:58:33 -07:00
Sebastian Markbåge
ed5f010ae5 Client render Suspense content if there's no boundary match (#16945)
Without the enableSuspenseServerRenderer flag there will never be a boundary match. Also when it is enabled, there might not be a boundary match if something was conditionally rendered by mistake.

With this PR it will now client render the content of a Suspense boundary in that case and issue a DEV only hydration warning. This is the only sound semantics for this case.

Unfortunately, landing this will once again break #16938. It will be less bad though because at least it'll just work by client rendering the content instead of hydrating and issue a DEV only warning.

However, we must land this before enabling the enableSuspenseServerRenderer flag since it does this anyway.

I did notice that we special case fallback={undefined} due to our unfortunate semantics for that. So technically a workaround that works is actually setting the fallback to undefined on the server and during hydration. Then flip it on only after hydration. That could be a workaround if you want to be able to have a Suspense boundary work only after hydration for some reason.

It's kind of unfortunate but at least those semantics are internally consistent. So I added a test for that.
2019-10-16 16:23:12 -07:00
Dominic Gannaway
916937563b [react-interactions] Add onFocusWithin event to FocusWithin responder (#17115) 2019-10-16 22:57:08 +02:00
Andrew Clark
d7feeb25ac unstable_createRoot -> createRoot in test (#17107)
Fixes test added in #17105, which was based on an earler commit than the
one that removed the `unstable_` prefix from `createRoot`.
2019-10-15 21:37:54 -07:00
Sebastian Markbåge
6ff23f2a5d Change retry priority to "Never" for dehydrated boundaries (#17105)
This changes the "default" retryTime to NoWork which schedules at Normal
pri.

Dehydrated bouundaries normally hydrate at Never priority except when they
retry where we accidentally increased them to Normal because Never was used
as the default value. This changes it so NoWork is the default.

Dehydrated boundaries however get initialized to Never as the default.

Therefore they now hydrate as Never pri unless their priority gets
increased by a forced rerender or selective hydration.

This revealed that erroring at this Never priority can cause an infinite
rerender. So I fixed that too.
2019-10-15 19:53:20 -07:00
Andrew Clark
2c832b4dcf Separate sizebot for experimental builds (#17100)
Configures the sizebot to leave a second comment that tracks the
experimental build artifacts.
2019-10-15 18:43:06 -07:00
Luna Ruan
3ac0eb075d Modify Babel React JSX Duplicate Children Fix (#17101)
If a JSX element has both a children prop and children (ie. <div children={childOne}>{childTwo}</div>), IE throws an Multiple definitions of a property not allowed in strict mode. This modifies the previous fix (which used an Object.assign) by making the duplicate children a sequence expression on the next prop/child instead so that ordering is preserved. For example:

```
<Component children={useA()} foo={useB()} children={useC()}>{useD()}</Component>
```
should compile to
```
React.jsx(Component, {foo: (useA(), useB()), children: (useC(), useD)})
```
2019-10-15 17:13:21 -07:00
Andrew Clark
43562455c9 Temporary patch www fork with prefixed APIs (#17103)
I'm doing this here instead of in the downstream repo so that if the
sync diff gets reverted, it doesn't revert this, too.

Once the sync has landed, and the callers are updated in www, I will
remove this.
2019-10-15 16:44:33 -07:00
Andrew Clark
9123c479f4 Enable concurrent APIs in all experimental forks (#17102)
Forgot to update the flags in the forked modules.
2019-10-15 16:19:45 -07:00
Andrew Clark
30c5daf943 Remove concurrent apis from stable (#17088)
* Tests run in experimental mode by default

For local development, you usually want experiments enabled. Unless
the release channel is set with an environment variable, tests will
run with __EXPERIMENTAL__ set to `true`.

* Remove concurrent APIs from stable builds

Those who want to try concurrent mode should use the experimental
builds instead.

I've left the `unstable_` prefixed APIs in the Facebook build so we
can continue experimenting with them internally without blessing them
for widespread use.

* Turn on SSR flags in experimental build

* Remove prefixed concurrent APIs from www build

Instead we'll use the experimental builds when syncing to www.

* Remove "canary" from internal React version string
2019-10-15 15:09:19 -07:00
Dominic Gannaway
4cb399a433 [react-interactions] Modify Scope query mechanism (#17095) 2019-10-15 15:57:02 +02:00
Dominic Gannaway
e7704e22a1 [babel-plugin-react-jsx] Avoid duplicate "children" key in props object (#17094)
* [babel-plugin-react-jsx] Avoid duplicate "children" key in props object

* Use Object.assign approach
2019-10-15 15:41:09 +02:00
Krzysztof Kotowicz
fdba0e5ce7 Fixed a bug with illegal invocation for Trusted Types (#17083)
* Fixed a bug with illegal invocation.

* Fixed the test.
2019-10-15 11:41:42 +01:00
Andrew Clark
a8c6a1b34e Update release scripts to support experimental releases (#17086)
* Download correct artifacts for release channel

Experimental builds should pull artifacts from the
`process_artifacts_experimental` job.

I think instead of two separate CI workflows, a better approach might
be to build stable artifacts to the `build` directory and the
experimental artifacts to a `build_experimental` directory, and
generate both within the same workflow. This would take some work since
lots of things assume the output directory is `build`, but something
to consider in the future.

* Prevent experimental promotion to stable

Adds a check to the `prepare-stable` script to prevent experimental
builds from being published using stable semver versions.
2019-10-14 14:15:23 -07:00
Andrew Clark
d364d8555f Set up experimental builds (#17071)
* Don't bother including `unstable_` in error

The method names don't get stripped out of the production bundles
because they are passed as arguments to the error decoder.

Let's just always use the unprefixed APIs in the messages.

* Set up experimental builds

The experimental builds are packaged exactly like builds in the stable
release channel: same file structure, entry points, and npm package
names. The goal is to match what will eventually be released in stable
as closely as possible, but with additional features turned on.

Versioning and Releasing
------------------------

The experimental builds will be published to the same registry and
package names as the stable ones. However, they will be versioned using
a separate scheme. Instead of semver versions, experimental releases
will receive arbitrary version strings based on their content hashes.
The motivation is to thwart attempts to use a version range to match
against future experimental releases. The only way to install or depend
on an experimental release is to refer to the specific version number.

Building
--------

I did not use the existing feature flag infra to configure the
experimental builds. The reason is because feature flags are designed
to configure a single package. They're not designed to generate multiple
forks of the same package; for each set of feature flags, you must
create a separate package configuration.

Instead, I've added a new build dimension called the **release
channel**. By default, builds use the **stable** channel. There's
also an **experimental** release channel. We have the option to add more
in the future.

There are now two dimensions per artifact: build type (production,
development, or profiling), and release channel (stable or
experimental). These are separate dimensions because they are
combinatorial: there are stable and experimental production builds,
stable and experimental developmenet builds, and so on.

You can add something to an experimental build by gating on
`__EXPERIMENTAL__`, similar to how we use `__DEV__`. Anything inside
these branches will be excluded from the stable builds.
This gives us a low effort way to add experimental behavior in any
package without setting up feature flags or configuring a new package.
2019-10-14 10:46:42 -07:00
Sebastian Markbåge
d5b54d0c35 [SuspenseList] Fix bugs with dropped Promises (#17082)
* Transfer any pending promises from inner boundary to list

For non-hidden modes, this boundary should commit so this shouldn't be
needed but the nested boundary can make a second pass which forces these
to be recreated without resuspending. In this case, the outer list assumes
that it can collect the inner promises to still rerender if needed.

* Propagate suspense "context" change to nested SuspenseLists

This means that we always rerender any nested SuspenseLists together.

This bug looks similar to the previous one but is not based on the lack of
retry but that the retry only happens on the outer boundary but the inner
doesn't get a retry ping since it didn't know about its own promise after
the second pass.
2019-10-14 09:42:10 -07:00
Andrew Clark
75955bf1d7 Pass prod error messages directly to constructor (#17063)
* Remove "Invariant Violation" from dev errors

When I made the change to compile `invariant` to throw expressions, I
left a small runtime to set the error's `name` property to "Invariant
Violation" to maintain the existing behavior.

I think we can remove it. The argument for keeping it is to preserve
continuity in error logs, but this only affects development errors,
anyway: production error messages are replaced with error codes.

* Pass prod error messages directly to constructor

Updates the `invariant` transform to pass an error message string
directly to the Error constructor, instead of mutating the
message property.

Turns this code:

```js
invariant(condition, 'A %s message that contains %s', adj, noun);
```

into this:

```js
if (!condition) {
  throw Error(
    __DEV__
      ? `A ${adj} message that contains ${noun}`
      : formatProdErrorMessage(ERR_CODE, adj, noun)
  );
}
```
2019-10-11 09:10:40 -07:00
Dominic Gannaway
0ac8e563d0 [react-interactions] Add getInstanceFromNode support to TestHostRenderer (#17065)
Fix bad WeakMap key case

Fix bad WeakMap key case
2019-10-11 16:58:27 +02:00
Brian Vaughn
22b2642a56 DevTools test shell tweaks (#17054)
* Updated DevTools shell ignore warning message to account for recent changes in warning text

* Update DevTools console patching to patch the parent window's console rather than the iframe, to more accurately simulate real usage environment
2019-10-09 12:37:25 -07:00
Eli White
4be45be5ff Stop warning about setNativeProps being deprecated (#17045)
* Stop warning about setNativeProps being deprecated

* Remove ReactNative.setNativeProps

* Remove more Fabric tests
2019-10-08 11:21:20 -07:00
Dominic Gannaway
b71ab61c8f [react-interactions] Adds more experimental Scope API methods (#17042) 2019-10-08 19:32:53 +02:00
Andrew Clark
5a71cbe7a9 Remove unused export
Meant to do this in e4b21be but neglected to `git add` the changes.
2019-10-07 15:32:34 -07:00
Andrew Clark
71d012ecd0 Remove dormant createBatch experiment (#17035)
* Remove dormant createBatch experiment

In a hybrid React app with multiple roots, `createBatch` is used to
coordinate an update to a root with its imperative container.

We've pivoted away from multi-root, hybrid React apps for now to focus
on single root apps.

This PR removes the API from the codebase. It's possible we'll add back
some version of this feature in the future.

* Remove unused export
2019-10-07 14:15:15 -07:00
Andrew Clark
cd1b167ad4 [Scheduler Profiler] Use microsecond precision (#17010)
The `performance.now` returns a timestamp in milliseconds as a float.
The browser has the option to adjust the precision of the float, but
it's usually more precise than a millisecond. However, this precision
is lost when the timestamp is logged by the Scheduler profiler, because
we store the numbers in an Int32Array.

This change multiplies the millisecond float value by 1000, giving us
three more degrees of precision.
2019-10-07 09:16:18 -07:00
Dominic Gannaway
55731fd8ce [react-interactions] Refine a11y component flow types (#17032) 2019-10-07 16:36:16 +02:00
Dominic Gannaway
a011aacafa [react-interactions] Remove FB builds of a11y components (#17030) 2019-10-07 12:45:49 +02:00
Dominic Gannaway
fff5b1ca77 [react-interactions] Add FocusTable colSpan support (#17019) 2019-10-07 12:04:41 +02:00
Luna Ruan
4bc52ef0df Revert "update hideOrUnhideAllChildren to hide portals that aren't wrapped in a host component (#16992)" (#17011)
This reverts commit de2edc268d.
2019-10-03 17:22:22 -07:00
Sebastian Markbåge
3a2b5f148d [Selective Hydration] ReactDOM.unstable_scheduleHydration(domNode) (#17004)
Adds an API to explicitly prioritize hydrating the path to a particular DOM node without relying on events to do it.

The API uses the current scheduler priority to schedule it. For the same priority, the last one wins. This allows a similar effect as continuous events. This is useful for example to hydrate based on scroll position, or prioritize components that will upgrade to client-rendered-only content.

I considered having an API that explicitly overrides the current target(s). However that makes it difficult to coordinate across components in an app.

This just hydrates one target at a time but if it is blocked on I/O we could consider increasing priority of later targets too.
2019-10-03 14:48:28 -07:00
Dominic Gannaway
26ba38ae4b [EnterLeaveEventPlugin] Fix bug when dealing with unhandled DOM nodes (#17006) 2019-10-03 23:35:09 +02:00
Andrew Clark
abedf17597 Changelog for v16.10.2 2019-10-03 14:16:13 -07:00
Andrew Clark
d256f88ac6 Update local version numbers for 16.10.2 release 2019-10-03 14:14:10 -07:00
Brian Vaughn
a8b8ffb894 DevTools v4.1.3 -> v4.2.0 2019-10-03 12:34:35 -07:00
Brian Vaughn
0545f366d4 Added trace updates feature (DOM only) (#16989)
* Added trace updates feature (DOM only)
* Updated DevTools CHANGELOG
2019-10-03 11:07:18 -07:00
Simen Bekkhus
e09097a75d chore: upgrade to jest 24 (#15778)
* chore: upgrade to jest 24

* download react-is from npm manually
2019-10-03 22:44:18 +05:30
Rane Wallin
5943b1da6c Fixing grammatical errors in error message (#16973)
* Fixing grammatical errors in error message

* Fixing grammar error in test file
2019-10-03 18:14:48 +05:30
Dominic Gannaway
4c5698400f [react-interactions] Remove context.setTimeout & context.clearTimeout (#17000) 2019-10-03 13:37:37 +02:00
Dominic Gannaway
b33633d932 [react-interactions] Repurpose React a11y modules (#16997) 2019-10-03 11:19:24 +02:00
Luna Ruan
de2edc268d update hideOrUnhideAllChildren to hide portals that aren't wrapped in a host component (#16992)
Currently, when a node suspends, if its subtree contains a portal, the portal is not hidden. This hides portals in the subtree when it's not wrapped in a host component .
2019-10-02 15:30:55 -07:00
Sebastian Markbåge
bb680a0905 [Selective Hydration] Prioritize the last continuous target (#16937)
* Prioritize the last continuous target

This ensures that the current focus target is always hydrated first.

Slightly higher than the usual Never expiration time used for hydration.
The priority increases with each new queued item so that the last always
wins.

* Don't export the moving target

It's not useful for comparison purposes anyway.
2019-10-02 14:52:23 -07:00
Eli White
10277cc5ba Remove unused canonical check in fiber host component (#16914) 2019-10-02 11:07:20 -07:00
Nicolas Gallagher
ab1a4f249e Move eventSystemFlags to last argument in event plugin extractors (#16978)
Fix for necolas/react-native-web#1443
2019-10-02 10:31:15 -07:00
Nicolas Gallagher
f6efb224b0 [react-interactions] Tap cancels on second pointerdown (#16936)
This patch causes onTapCancel to be called whenever a second pointer interacts
with the responder target.
2019-10-01 15:13:31 -07:00
Dominic Gannaway
34457729a6 [react-interactions] Add allowModifiers flag to FocusList + FocusTable (#16971) 2019-10-01 17:59:52 +02:00
Rango Yuan
b34f042e5b Fix mouseenter handlers fired twice (#16928) 2019-10-01 14:03:14 +02:00
Andrew Clark
05dc814cf0 Remove IIFE wrappers from dev invariant checks (#16963)
The error transform works by replacing calls to `invariant` with
an `if` statement.

Since we're replacing a call expression with a statement, Babel wraps
the new statement in an immediately-invoked function expression (IIFE).
This wrapper is unnecessary in practice because our `invariant` calls
are always part of their own expression statement.

In the production bundle, the function wrappers are removed by Closure.
But they remain in the development bundles.

This commit updates the transform to confirm that an `invariant` call
expression's parent node is an expression statement. (If not, it throws
a transform error.)

Then, it replaces the expression statement instead of the expression
itself, effectively removing the extraneous IIFE wrapper.
2019-09-30 11:14:51 -07:00
Brian Vaughn
2c8832075b React DevTools v4.1.2 -> v.4.1.3 2019-09-30 09:33:23 -07:00
Brian Vaughn
6c73a1e776 Updated DevTools CHANGELOG 2019-09-30 08:31:47 -07:00
David Huang
6a3de7a414 [DevTools] postMessage target origin needs to be '*' for local files (#16953) 2019-09-30 08:29:18 -07:00
Dominic Gannaway
ac8e8b3278 [react-interactions] Add tab handling to FocusList (#16958) 2019-09-30 17:13:35 +02:00
Dominic Gannaway
10c7dfe3b4 [react-interactins] FocusTable tabScope handling+tabIndex control (#16922) 2019-09-30 11:41:20 +02:00
Kirankumar Ambati
d3622d0f97 chore: updated comment message (#16949) 2019-09-29 15:00:49 -07:00
Andrew Clark
2a264a9dbe Update local version numbers for 16.10.1 release 2019-09-28 21:41:42 -07:00
Andrew Clark
22019ef5a2 Changelog for v16.10.1 2019-09-28 11:24:19 -07:00
Sebastian Markbåge
d8a76ad580 Allow Suspense Mismatch on the Client to Silently Proceed (#16943)
* Regression test: Suspense + hydration + legacy

* Allow Suspense Mismatch on the Client to Silently Proceed

This fixes but isn't actually the semantics that we want this case to have.
2019-09-28 10:43:53 -07:00
Sebastian Markbåge
9d637844e9 Remove enableUserBlockingEvents flag (#16882)
Seems like this worked out. We can clean up the flag now.
2019-09-27 19:46:56 -07:00
Sebastian Markbåge
fe31cc710e [Selective Hydration] Increase priority for non-synchronous discrete events and retries (#16935)
* Increase retryTime for increased priority dehydrated boundaries

* Increaese the priority to user blocking for every next discrete boundary
2019-09-27 17:27:17 -07:00
Brian Vaughn
b550679617 Fixed typo in DevTools CHANGELOG 2019-09-27 17:10:27 -07:00
Brian Vaughn
5184346daf DevTools v4.1.1 -> v4.1.2 2019-09-27 17:03:17 -07:00
Brian Vaughn
d4278663c6 Replaced === check with Object.is() to support values like NaN (#16934) 2019-09-27 16:54:53 -07:00
Nicolas Gallagher
d1121c0174 [react-interactions] Fix virtual click heuristic (#16915) 2019-09-27 15:38:47 -07:00
Andrew Clark
f553515d1e Fix heading level in changelog 2019-09-27 13:37:36 -07:00
Andrew Clark
7dc83a6100 Changelog for 16.10 2019-09-27 13:31:47 -07:00
Andrew Clark
93f5f11b79 Update local version numbers for 16.10 release 2019-09-27 13:31:35 -07:00
Luna Ruan
c8dc7a926e expose isHydrating (#16909)
expose isHydrating for FB
2019-09-26 14:47:01 -07:00
Eli White
db8afe4f63 Add HostComponent type to ReactNative (#16898)
* Add HostComponent type to ReactNative

* Use type alias imports instead of wildcard

* Fix forgotten Object in measureLayout type
2019-09-26 14:42:18 -07:00
Andrew Clark
fad5102101 [bugfix] Fix false positive render phase update (#16907)
Need to reset the current "debug phase" inside the catch block.
Otherwise React thinks we're still in the render phase during the
subsequent event.
2019-09-26 12:47:48 -07:00
Brian Vaughn
a9cd9a765b DevTools v4.1.0 -> v4.1.1 2019-09-26 10:22:59 -07:00
Brian Vaughn
b6606ecba8 DevTools shows unsupported renderer version dialog (#16897)
* DevTools shows unsupported renderer version dialog

* Optimistic CHANGELOG udpate
2019-09-26 08:41:46 -07:00
Brian Vaughn
84e83db1ee Updated DevTools CHANGELOG 2019-09-26 08:26:18 -07:00
Dominic Gannaway
b9811ed5bc [react-interactions] Add wrapping support to FocusList/FocusTable (#16903) 2019-09-26 15:15:48 +02:00
David Huang
49b0cb6db8 Moving backend injection to the content script (#16900) 2019-09-26 14:03:07 +01:00
Sebastian Markbåge
3694a3b5e9 Selective Hydration (#16880)
* Add Feature Flag for Selective Hydration

* Enable Synchronous Hydration of Discrete Events

* Resolve cyclic dependency
2019-09-25 15:26:27 -07:00
Dominic Gannaway
4bb0e96b4b [react-interactions] FocusTable key press bound propgataion (#16895) 2019-09-25 21:12:39 +02:00
Brian Vaughn
fa1a326227 Update useEditableValue hook to sync external value changes (#16878)
* Update useEditableValue to mirror value cahnges

Previously, the hook initialized local state (in useState) to mirror the prop/state value. Updates to the value were ignored though. (Once the state was initialized, it was never updated.) The new hook updates the local/editable state to mirror the external value unless there are already pending, local edits being made.

* Optimistic CHANGELOG update

* Added additional useEditableValue() unit test cases
2019-09-25 10:46:27 -07:00
Dominic Gannaway
57bf275fbd [devtools] Add support for React Scope symbol/number (#16893) 2019-09-25 19:03:37 +02:00
Dominic Gannaway
7c3bd08b37 [react-interactions] Add more documentation for a11y components (#16894) 2019-09-25 19:01:15 +02:00
Sebastian Markbåge
a06d181af0 Include tag in begin/complete invariant (#16881) 2019-09-25 08:10:35 -07:00
Sebastian Markbåge
0d8c0cd096 These flags are hard coded in our internal config (#16883)
By hard coding them here they can get properly DCE and don't have to be
sent to users. The internal config should only have dynamic flags.
2019-09-25 08:00:29 -07:00
Dominic Gannaway
d6d83d7060 [react-interactions] Add Portal propagation configuration (#16889) 2019-09-25 16:56:51 +02:00
Dominic Gannaway
d0ebde77f6 [react-interactions] Add initial docs explaining React Scopes (#16892) 2019-09-25 14:57:47 +02:00
Joshua Gross
32e5c97d11 [React Native] Improve errors for invalid ViewConfig getter functions (#16879)
* [React Native] Improve logging for missing view configs and invalid view config getter functions

* [React Native] Improve logging for missing view configs and invalid view config getter functions
2019-09-24 17:46:21 -07:00
Dominic Gannaway
ebc299fc2f [react-interactions] TabFocus -> FocusManager (#16874) 2019-09-24 23:26:20 +02:00
Dominic Gannaway
793f176dad [react-interactions] Make FocusList bundle (#16876) 2019-09-24 18:02:13 +02:00
Dominic Gannaway
68a87eee54 [react-interactions] Add FocusList component (#16875) 2019-09-24 17:14:29 +02:00
Jessica Franco
18d2e0c03e Warning system refactoring (part 1) (#16799)
* Rename lowPriorityWarning to lowPriorityWarningWithoutStack

This maintains parity with the other warning-like functions.

* Duplicate the toWarnDev tests to test toLowPriorityWarnDev

* Make a lowPriorityWarning version of warning.js

* Extract both variants in print-warning

Avoids parsing lowPriorityWarning.js itself as the way it forwards the
call to lowPriorityWarningWithoutStack is not analyzable.
2019-09-24 13:45:38 +01:00
Andrew Clark
8b580a89d6 Idle updates should not be blocked by hidden work (#16871)
* Idle updates should not be blocked by hidden work

Use the special `Idle` expiration time for updates that are triggered at
Scheduler's `IdlePriority`, instead of `Never`.

The key difference between Idle and Never¹ is that Never work can be
committed in an inconsistent state without tearing the UI. The main
example is offscreen content, like a hidden subtree.

¹ "Never" isn't the best name. I originally called it that because it
"never" expires, but neither does Idle. Since it's mostly used for
offscreen subtrees, we could call it "Offscreen." However, it's also
used for dehydrated Suspense boundaries, which are inconsistent in the
sense that they haven't finished yet, but aren't visibly inconsistent
because the server rendered HTML matches what the hydrated tree would
look like.

* Reset as early as possible using local variable

* Updates in a hidden effect should be Idle

I had made them Never to avoid an extra render when a hidden effect
updates the hidden component -- if they are Idle, we have to render once
at Idle, which bails out on the hidden subtree, then again at Never to
actually process the update -- but the problem of needing an extra
render pass to bail out hidden updates already exists and we should fix
that properly instead of adding yet another special case.
2019-09-23 20:52:48 -07:00
Nicolas Gallagher
c5e7190ed4 [react-interactions] Press with useRef instead of useState (#16870)
We only need to read and modify the value for the lifetime of the hook
2019-09-23 16:25:13 -07:00
Brian Vaughn
911104a129 DevTools CHANGELOG update 2019-09-23 12:58:58 -07:00
Brian Vaughn
bce2ac63a9 Revert change to backend injection method from PR #16752 (#16864)
PR #16752 changed how we were injecting the backend script to be done by the content script in order to work around Trusted Type limitations with our previous approach. This may have caused a regression (see #16840) so I'm backing it out to verify.
2019-09-23 12:56:36 -07:00
Brian Vaughn
9b3cde9b62 Fix DevTools v4.1 editable hook regression (#16867)
* Fixed a regression in hooks editor from a recent EditableValue change

* Fixed a reset/state bug in useEditableValue() hook and removed unnecessary useMemo()
2019-09-23 12:56:01 -07:00
Dominic Gannaway
1a6294d3e2 [react-interaction] Refactor a11y components more (#16866) 2019-09-23 21:30:49 +02:00
Dominic Gannaway
1758b3f7ba [react-interactions] Add no-op stopPropagation + preventDefault to Press (#16868)
Fix
2019-09-23 21:18:40 +02:00
Andrew Clark
013b7ad117 [suspense][error handling] Inline renderRoot and fix error handling bug (#16801)
* Outline push/pop logic in `renderRoot`

I want to get rid of the the `isSync` argument to `renderRoot`, and
instead use separate functions for concurrent and synchronous render.

As a first step, this extracts the push/pop logic that happens before
and after the render phase into helper functions.

* Extract `catch` block into helper function

Similar to previous commit. Extract error handling logic into
a separate function so it can be reused.

* Fork `renderRoot` for sync and concurrent

Removes `isSync` argument in favor of separate functions.

* Extra "root completion" logic to separate function

Moving this out to avoid an accidental early return, which would
bypass the call to `ensureRootIsScheduled` and freeze the UI.

* Inline `renderRoot`

Inlines `renderRoot` into `performConcurrentWorkOnRoot` and
`performSyncWorkOnRoot`. This lets me remove the `isSync` argument
and also get rid of a redundant try-catch wrapper.

* [suspense][error handling] Add failing unit test

Covers an edge case where an error is thrown inside the complete phase
of a component that is in the return path of a component that suspends.
The second error should also be handled (i.e. able to be captured by
an error boundary.

The test is currently failing because there's a call to
`completeUnitOfWork` inside the main render phase `catch` block. That
call is not itself wrapped in try-catch, so anything that throws is
treated as a fatal/unhandled error.

I believe this bug is only observable if something in the host config
throws; and, only in legacy mode, because in concurrent/batched mode,
`completeUnitOfWork` on fiber that throws follows the "unwind" path
only, not the "complete" path, and the "unwind" path does not call
any host config methods.

* [scheduler][profiler] Start time of delayed tasks

Fixes a bug in the Scheduler profiler where the start time of a delayed
tasks is always 0.

* Remove ad hoc `throw`

Fatal errors (errors that are not captured by an error boundary) are
currently rethrown from directly inside the render phase's `catch`
block. This is a refactor hazard because the code in this branch has
to mirror the code that happens at the end of the function, when exiting
the render phase in the normal case.

This commit moves the throw to the end, using a new root exit status.

* Handle errors that occur on unwind
2019-09-23 11:23:28 -07:00
Sebastian Markbåge
0a527707cd Event Replaying (#16725)
* Add Event Replaying Infra

* Wire up Roots and Suspense boundaries, to retry events, after they commit

* Replay discrete events in order in a separate scheduler callback

* Add continuous events

These events only replay their last target if the target is not yet
hydrated. That way we don't have to wait for a previously hovered
boundary before invoking the current target.

* Enable tests from before

These tests were written with replaying in mind and now we can properly
enable them.

* Unify replaying and dispatching

* Mark system flags as a replay and pass to legacy events

That way we can check if this is a replay and therefore needs a special
case. One such special case is "mouseover" where we check the
relatedTarget.

* Eagerly listen to all replayable events

To minimize breakages in a minor, I only do this for the new root APIs
since replaying only matters there anyway. Only if hydrating.

For Flare, I have to attach all active listeners since the current
system has one DOM listener for each. In a follow up I plan on optimizing
that by only attaching one if there's at least one active listener
which would allow us to start with only passive and then upgrade.

* Desperate attempt to save bytese

* Add test for mouseover replaying

We need to check if the "relatedTarget" is mounted due to how the old
event system dispatches from the "out" event.

* Fix for nested boundaries and suspense in root container

This is a follow up to #16673 which didn't have a test because it wasn't
observable yet. This shows that it had a bug.

* Rename RESPONDER_EVENT_SYSTEM to PLUGIN_EVENT_SYSTEM
2019-09-23 11:21:10 -07:00
Andrew Clark
a87d245fc2 [work loop] Prevent work loop from being inlined (#16865)
Uses Closure Compiler's `@noinline` directive.

See https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler#noinline
2019-09-23 11:12:47 -07:00
Nicolas Gallagher
312b462d54 [react-interactions] Improve consistency of Tap responder (#16837)
Makes sure that touch events with modifier keys behave the same way as other
pointer types (i.e., does not call `onTapStart` if the gesture begins with a
modifier key held down)
2019-09-23 10:48:11 -07:00
Dominic Gannaway
70754f10d4 [react-interaction] Tweak Focus Table component (#16862) 2019-09-23 16:39:43 +02:00
Dominic Gannaway
d7f6dd5a80 [react-interactions] Fix typo in FocusTable (#16860) 2019-09-23 14:20:43 +02:00
Dan Abramov
cef47cbc01 Rename experimental react-ui => react-interactions (#16842) 2019-09-20 11:51:03 +01:00
Dominic Gannaway
57a5805a9f [react-ui] Add preventDefault+stopPropagation to Keyboard + update Focus components (#16833) 2019-09-20 11:21:38 +02:00
Brian Vaughn
08b51aa384 Added React DevTools v4.1.0 release date to CHANGELOG 2019-09-19 15:22:22 -07:00
Brian Vaughn
b5cebedfbe React DevTools version bump 4.0.6 -> 4.1.0 2019-09-19 15:11:48 -07:00
Sebastian Markbåge
35bf9d27a3 Exclude react-dom when flow checking other builds (#16737)
This is because the HostConfig can't be guaranteed to be consistent with
other code such as code that touches the DOM directly.

Ideally we'd have a more systemic solution to this since it will pop
up for other packages later too.
2019-09-19 12:41:51 -07:00
Nicolas Gallagher
fd870e6b6a [react-ui/events] Tap responder API changes (#16827)
This patch limits the `onTap*` callbacks to the primary pointer button.
Auxiliary button and modified primary button interactions call
`onAuxiliaryTap`, cancel any active tap, and preserve the native behavior.
2019-09-19 09:36:29 -07:00
Dan Abramov
4ddcb8e134 [DevTools] Remove Welcome dialog (#16834) 2019-09-19 08:41:18 -07:00
Dominic Gannaway
924a305780 [react-ui] Remove event object warnings (#16822) 2019-09-19 12:46:17 +02:00
halvves
a5df18a9e5 prevent firefox marking required textareas invalid (#16578)
* prevent firefox marking required textareas invalid

Bug was caused by an IE10/IE11 bugfix dealing with the placeholder attribute and textContent. Solved by avoiding the IE bugfix when textContent was empty.

Closes #16402

* more explicit conditional check for textContent

re: @philipp-spiess code review

* clarify textarea test fixture's expected result

better describe the behavior we are testing for
re: @philipp-spiess code review
2019-09-18 14:38:02 -07:00
Dan Abramov
f818af9b03 [Fresh] Always remount classes (#16823) 2019-09-18 16:32:11 +01:00
Ricky
6ecfa90eb0 [React Native] Fix for view config registrations (#16821) 2019-09-18 15:31:00 +01:00
Dominic Gannaway
18cb59050b [react-core] Do not null fiber.sibling in detachFiber (#16820) 2019-09-18 14:18:32 +02:00
Kuba Juszczyk
d862f0ea56 Optimize objectIs (#16212) 2019-09-17 23:55:43 +02:00
Pavlo Tymchuk
d1c2555861 [react-devtools-shared] Added string type check for object name prop in getDisplayName function (#16798)
* [react-devtools-shared] Added string type check for object name prop in getDisplayName function from utils.js file; tests included;

* Re-added empty string check to getDisplayName()

* Tweaked tests to use real functions

This more closely simulates how the utility is being used in production, and would catch cases like anonymous functions (with empty string names).
2019-09-17 13:17:04 -07:00
Brian Vaughn
70dcdd265d Updated pending CHANGELOG for DevTools 2019-09-17 13:15:53 -07:00
Brian Vaughn
e8c7ddeef2 Release script filters DevTools NPM pakcages (#16810) 2019-09-17 12:46:13 -07:00
Dominic Gannaway
8f1533f4d8 [react-ui] Fix bundle name [hotfix] (#16811) 2019-09-17 21:10:51 +02:00
Dominic Gannaway
7c802de797 [react-a11y] Add react-ui/accessibility to bundle build (#16804) 2019-09-17 20:22:09 +02:00
Andrew Clark
901139c291 [scheduler][profiler] Start time of delayed tasks (#16809)
Fixes a bug in the Scheduler profiler where the start time of a delayed
tasks is always 0.
2019-09-17 10:24:48 -07:00
Dominic Gannaway
f40ceb0010 [react-ui] FocusGrid -> ReactFocusTable + tweaks and fixes (#16806) 2019-09-17 19:22:10 +02:00
Dominic Gannaway
2f1e8c5f78 [react-core] Clear more properties in detachFiber (#16807) 2019-09-17 17:30:22 +02:00
Dan Abramov
8e0c574122 Follow-up to initial Trusted Types support (#16795)
* Follow-up to initial Trusted Types support

* Fast-path both strings and numbers

* Move shared objects out of every test
2019-09-17 16:06:26 +01:00
Nicolas Gallagher
3af05de1aa [react-ui] usePress from useKeyboard and useTap (#16772)
This implements 'usePress' in user-space as a combination of 'useKeyboard' and 'useTap'.  The existing 'usePress' API is preserved for now. The previous 'usePress' implementation is moved to 'PressLegacy'.
2019-09-16 14:36:27 -07:00
Dominic Gannaway
494300b366 [react-ui] Move experimental event+a11y work to react-ui package (#16794) 2019-09-16 20:05:50 +02:00
Nicolas Gallagher
9691eb273a [react-events] Keyboard support for virtual clicks (#16780)
This accounts for all clicks that are natively dispatched following relevant
keyboard interactions (e.g., key is "Enter"), as well as programmatic clicks,
and screen-reader virtual clicks.
2019-09-16 10:40:05 -07:00
Emanuel Tesař
b8d079b413 Add trusted types to react on client side (#16157)
* Add trusted types to react on client side

* Implement changes according to review

* Remove support for trusted URLs, change TrustedTypes to trustedTypes

* Add support for deprecated trusted URLs

* Apply PR suggesstions

* Warn only once, remove forgotten check, put it behind a flag

* Move comment

* Fix PR comments

* Fix html toString concatenation

* Fix forgotten else branch

* Fix PR comments
2019-09-16 13:43:22 +01:00
Heaven
cdbfa5044b fix typo inteval -> interval & continutation -> continuation (#16760)
* fix typo alterate -> alternate

* fix typo interal -> interval & continutation -> continuation
2019-09-14 12:51:20 -07:00
Andrew Clark
45b6443c90 Spelling is fundamental (#16782) 2019-09-13 16:27:18 -07:00
Andrew Clark
45898d0be0 [Scheduler] Prevent event log from growing unbounded (#16781)
If a Scheduler profile runs without stopping, the event log will grow
unbounded. Eventually it will run out of memory and the VM will throw
an error.

To prevent this from happening, let's automatically stop the profiler
once the log exceeds a certain limit. We'll also print a warning with
advice to call `stopLoggingProfilingEvents` explicitly.
2019-09-13 15:50:25 -07:00
Nicolas Gallagher
87eaa90ef8 [react-events] Keyboard calls preventDefault on 'click' events (#16779)
Make sure to call preventDefault for any 'click' events that follow a 'keydown'
event that matches 'preventKeys'
2019-09-13 13:19:18 -07:00
Brian Vaughn
0c0b30b8c7 Remove unnecessary interaction tracing ping wrapper (#16777) 2019-09-13 11:04:36 -07:00
Andrew Clark
137ea783b1 Re-enable risky work loop changes (#16771)
The stack of PRs in #16743 was reverted. This adds them back.
2019-09-13 09:33:46 -07:00
Brian Vaughn
d6f6b951e1 Support disabling interaction tracing for suspense promises (#16776)
* Support disabling interaction tracing for suspense promises

If a thrown Promise has the __reactDoNotTraceInteractions attribute, React will not wrapped its callbacks to continue tracing any current interaction(s).

* Added optional '__reactDoNotTraceInteractions' attribute to Flow Thenable type
2019-09-13 08:59:57 -07:00
Dominic Gannaway
b4b8a349a3 [react-interactions] Add experimental FocusGrid API (#16766) 2019-09-13 12:29:39 +02:00
Andrew Clark
a7dabcb60a Revert "Re-arrange slightly to prevent refactor hazard (#16743)" (#16769)
This reverts commit ab4951fc03.

* Track "pending" and "suspended" ranges

A FiberRoot can have pending work at many distinct priorities. (Note: we
refer to these levels as "expiration times" to distinguish the concept
from Scheduler's notion of priority levels, which represent broad
categories of work. React expiration times are more granualar. They're
more like a concurrent thread ID, which also happens to correspond to a
moment on a timeline. It's an overloaded concept and I'm handwaving over
some of the details.)

Given a root, there's no convenient way to read all the pending levels
in the entire tree, i.e. there's no single queue-like structure that
tracks all the levels, because that granularity of information is not
needed by our algorithms. Instead we track the subset of information
that we actually need — most importantly, the highest priority level
that exists in the entire tree.

Aside from that, the other information we track includes the range of
pending levels that are known to be suspended, and therefore should not
be worked on.

This is a refactor of how that information is tracked, and what each
field represents:

- A *pending* level is work that is unfinished, or not yet committed.
  This includes work that is suspended from committing.
  `firstPendingTime` and `lastPendingTime` represent the range of
  pending work. (Previously, "pending" was the same as "not suspended.")
- A *suspended* level is work that did not complete because data was
  missing. `firstSuspendedTime` and `lastSuspendedTime` represent the
  range of suspended work. It is a subset of the pending range. (These
  fields are new to this commit.)
- `nextAfterSuspendedTime` represents the next known level that comes
  after the suspended range.

This commit doesn't change much in terms of observable behavior. The one
change is that, when a level is suspended, React will continue working
on the next known level instead of jumping straight to the last pending
level. Subsequent commits will use this new structure for a more
substantial refactor for how tasks are scheduled per root.

* Get next expiration time from FiberRoot

Given a FiberRoot, we should be able to determine the next expiration
time that needs to be worked on, taking into account the levels that
are pending, suspended, pinged, and so on.

This removes the `expirationTime` argument from
`scheduleCallbackForRoot`, and renames it to `ensureRootIsScheduled` to
reflect the new signature. The expiration time is instead read from the
root using a new function, `getNextExpirationTimeToWorkOn`.

The next step will be to remove the `expirationTime` argument from
`renderRoot`, too.

* Don't bind expiration time to render callback

This is a fragile pattern because there's only meant to be a single
task per root, running at a single expiration time. Instead of binding
the expiration time to the render task, or closing over it, we should
determine the correct expiration time to work on using fields we
store on the root object itself.

This removes the "return a continuation" pattern from the
`renderRoot` function. Continuation handling is now handled by
the wrapper function, which I've renamed from `runRootCallback` to
`performWorkOnRoot`. That function is merely an entry point to
`renderRoot`, so I've also removed the callback argument.

So to sum up, at at the beginning of each task, `performWorkOnRoot`
determines which expiration time to work on, then calls `renderRoot`.
And before exiting, it checks if it needs to schedule another task.

* Update error recovery test to match new semantics

* Remove `lastPendingTime` field

It's no longer used anywhere

* Restart on update to already suspended root

If the work-in-progress root already suspended with a delay, then the
current render definitely won't finish. We should interrupt the render
and switch to the incoming update.

* Restart on suspend if return path has an update

Similar to the previous commit, if we suspend with a delay, and
something in the return path has a pending update, we should abort
the current render and switch to the update instead.

* Track the next unprocessed level globally

Instead of backtracking the return path. The main advantage over the
backtracking approach is that we don't have to backtrack from the source
fiber. (The main disadvantages are that it requires another module-level
variable, and that it could include updates from unrelated
sibling paths.)

* Re-arrange slightly to prevent refactor hazard

It should not be possible to perform any work on a root without
calling `ensureRootIsScheduled` before exiting. Otherwise, we could
fail to schedule a callback for pending work and the app could freeze.

To help prevent a future refactor from introducing such a bug, this
change makes it so that `renderRoot` is always wrapped in try-finally,
and the `finally` block calls `ensureRootIsScheduled`.

* Remove recursive calls to `renderRoot`.

There are a few leftover cases where `renderRoot` is called recursively.
All of them are related to synchronously flushing work before its
expiration time.

We can remove these calls by tracking the last expired level on the
root, similar to what we do for other types of pending work, like pings.

* Remove argument from performSyncWorkOnRoot

Read the expiration time from the root, like we do
in performConcurrentWorkOnRoot.
2019-09-12 14:21:57 -07:00
Dominic Gannaway
4b0b556dcf [react-interactions] Refactor TabFocusController (#16768) 2019-09-12 22:28:07 +02:00
Brian Vaughn
fb39f62925 Added upcoming changes to DevTools CHANGELOG 2019-09-12 08:34:28 -07:00
Anton Korzunov
ba932a5ad9 fix: inspect ClassComponent.render instead of constructor, fixes #16749 (#16759) 2019-09-12 08:32:42 -07:00
Dominic Gannaway
35a202d0e7 [react-events] Ensure we restore currentInstance + currentTimers (#16758) 2019-09-12 12:44:05 +02:00
Dominic Gannaway
3717c25a7e [react-interactions] More Tab Focus control handling (#16751) 2019-09-11 22:35:33 +02:00
Andrew Clark
0a2215cc0e [Scheduler][www] Put profiling feature behind flag (#16757)
Our infra currently doesn't support loading a separate profiling
build of Scheduler. Until that's fixed, the recommendation is to load
a single build and gate the profiling feature behind a flag.

Alternative to #16659
2019-09-11 13:28:03 -07:00
Brian Vaughn
8f03109cd2 Moved backend injection to the content script (#16752)
* Moved backend injection logic to content script

* Moved backend injection logic to content script

* Moved injection logic to content script

* Formatting changes

* remove ability to inject arbitrary scripts

* Removed done(), added some comments explaining the change

* Lint fixes

* Moved inline comment.

* Deleted inject() script since it was no longer being used
2019-09-11 09:51:32 -07:00
Brian Vaughn
efa780d0ab Removed DT inject() script since it's no longer being used 2019-09-11 09:51:24 -07:00
Brian Vaughn
4290967d4c Merge branch 'tt-compat' of https://github.com/onionymous/react into onionymous-tt-compat 2019-09-11 09:34:31 -07:00
Brian Vaughn
f09854a9e8 Moved inline comment. 2019-09-11 09:30:57 -07:00
Stephanie Ding
776d1c69b9 Lint fixes 2019-09-11 08:11:14 -07:00
Dominic Gannaway
3a49dff386 [react-events] Use context.objectAssign in Tap responder (#16748) 2019-09-11 17:06:40 +02:00
Stephanie Ding
2e75000f40 Removed done(), added some comments explaining the change 2019-09-11 08:05:27 -07:00
Matt Kane
56114a4b22 Change trackedTouchCount console.error to warn (#16750) 2019-09-11 14:10:26 +02:00
Dominic Gannaway
ae724be7be [react-interactions] Add TabFocusContainer and TabbableScope UI components (#16732) 2019-09-11 12:46:41 +02:00
Andrew Clark
ab4951fc03 Re-arrange slightly to prevent refactor hazard (#16743)
* Track "pending" and "suspended" ranges

A FiberRoot can have pending work at many distinct priorities. (Note: we
refer to these levels as "expiration times" to distinguish the concept
from Scheduler's notion of priority levels, which represent broad
categories of work. React expiration times are more granualar. They're
more like a concurrent thread ID, which also happens to correspond to a
moment on a timeline. It's an overloaded concept and I'm handwaving over
some of the details.)

Given a root, there's no convenient way to read all the pending levels
in the entire tree, i.e. there's no single queue-like structure that
tracks all the levels, because that granularity of information is not
needed by our algorithms. Instead we track the subset of information
that we actually need — most importantly, the highest priority level
that exists in the entire tree.

Aside from that, the other information we track includes the range of
pending levels that are known to be suspended, and therefore should not
be worked on.

This is a refactor of how that information is tracked, and what each
field represents:

- A *pending* level is work that is unfinished, or not yet committed.
  This includes work that is suspended from committing.
  `firstPendingTime` and `lastPendingTime` represent the range of
  pending work. (Previously, "pending" was the same as "not suspended.")
- A *suspended* level is work that did not complete because data was
  missing. `firstSuspendedTime` and `lastSuspendedTime` represent the
  range of suspended work. It is a subset of the pending range. (These
  fields are new to this commit.)
- `nextAfterSuspendedTime` represents the next known level that comes
  after the suspended range.

This commit doesn't change much in terms of observable behavior. The one
change is that, when a level is suspended, React will continue working
on the next known level instead of jumping straight to the last pending
level. Subsequent commits will use this new structure for a more
substantial refactor for how tasks are scheduled per root.

* Get next expiration time from FiberRoot

Given a FiberRoot, we should be able to determine the next expiration
time that needs to be worked on, taking into account the levels that
are pending, suspended, pinged, and so on.

This removes the `expirationTime` argument from
`scheduleCallbackForRoot`, and renames it to `ensureRootIsScheduled` to
reflect the new signature. The expiration time is instead read from the
root using a new function, `getNextExpirationTimeToWorkOn`.

The next step will be to remove the `expirationTime` argument from
`renderRoot`, too.

* Don't bind expiration time to render callback

This is a fragile pattern because there's only meant to be a single
task per root, running at a single expiration time. Instead of binding
the expiration time to the render task, or closing over it, we should
determine the correct expiration time to work on using fields we
store on the root object itself.

This removes the "return a continuation" pattern from the
`renderRoot` function. Continuation handling is now handled by
the wrapper function, which I've renamed from `runRootCallback` to
`performWorkOnRoot`. That function is merely an entry point to
`renderRoot`, so I've also removed the callback argument.

So to sum up, at at the beginning of each task, `performWorkOnRoot`
determines which expiration time to work on, then calls `renderRoot`.
And before exiting, it checks if it needs to schedule another task.

* Update error recovery test to match new semantics

* Remove `lastPendingTime` field

It's no longer used anywhere

* Restart on update to already suspended root

If the work-in-progress root already suspended with a delay, then the
current render definitely won't finish. We should interrupt the render
and switch to the incoming update.

* Restart on suspend if return path has an update

Similar to the previous commit, if we suspend with a delay, and
something in the return path has a pending update, we should abort
the current render and switch to the update instead.

* Track the next unprocessed level globally

Instead of backtracking the return path. The main advantage over the
backtracking approach is that we don't have to backtrack from the source
fiber. (The main disadvantages are that it requires another module-level
variable, and that it could include updates from unrelated
sibling paths.)

* Re-arrange slightly to prevent refactor hazard

It should not be possible to perform any work on a root without
calling `ensureRootIsScheduled` before exiting. Otherwise, we could
fail to schedule a callback for pending work and the app could freeze.

To help prevent a future refactor from introducing such a bug, this
change makes it so that `renderRoot` is always wrapped in try-finally,
and the `finally` block calls `ensureRootIsScheduled`.

* Remove recursive calls to `renderRoot`.

There are a few leftover cases where `renderRoot` is called recursively.
All of them are related to synchronously flushing work before its
expiration time.

We can remove these calls by tracking the last expired level on the
root, similar to what we do for other types of pending work, like pings.

* Remove argument from performSyncWorkOnRoot

Read the expiration time from the root, like we do
in performConcurrentWorkOnRoot.
2019-09-10 20:07:12 -07:00
Sebastian Markbåge
b0a8a3e041 Mark root as already hydrated after committing (#16739)
* Mark root as already hydrated after committing

* Remove current/child check for hydration and rely on the root flag instead
2019-09-10 20:02:02 -07:00
Sebastian Markbåge
e04f4259c4 Handle SuspenseListComponent getting retried (#16745)
This happens for example when a deleted boundary transfers its pending
promises to the list so that the list can be retried.

This wasn't caught by unit tests because this flag wasn't on in those
tests.
2019-09-10 19:38:44 -07:00
Stephanie Ding
8a6cd3cd12 remove ability to inject arbitrary scripts 2019-09-10 18:06:23 -07:00
Stephanie Ding
d51f062d03 Formatting changes 2019-09-10 17:46:29 -07:00
Stephanie Ding
85c7211014 Moved injection logic to content script 2019-09-10 17:45:27 -07:00
Stephanie Ding
788036c7ed Moved backend injection logic to content script 2019-09-10 17:34:12 -07:00
Stephanie Ding
c93038fabe Moved backend injection logic to content script 2019-09-10 17:22:04 -07:00
Brian Vaughn
2c98af77c3 DevTools: Props editing interface tweaks (#16740)
* Fix DevTools new prop input size
* Don't allow adding new values unless an overridePropsFn function has been provided.
* Do not show empty 'none' label ablve a new prop input
2019-09-10 14:57:33 -07:00
Brian Vaughn
2ce5801c25 Added upcoming changes to DevTools CHANGELOG 2019-09-10 13:32:53 -07:00
Hristo Kanchev
709baf1fec [DevTools] Support for adding props | Improved state/props value editing (#16700)
* Extracted sanitizeForParse

* Added canAddEntries flag to InspectedElementTree

* Added EditableKey component.

* Added support to add an additional entry.

* Added support to add more complex data structures in the EditableValue component. Added support to change the dataType of the value that is being changed.

* Fixed flow error.

* Removed unneeded fragment.

* Renamed EditableKey -> EditableName

* Removed unneeded dependency

* Removed problematic props to state hook.

* Prettified changes.

* Removed unused import.

* Fixed shouldStringify check.

* Removed testing props from EditableProps.

* Made some inline tweaks
2019-09-10 13:30:43 -07:00
Hristo Kanchev
4ef6387d6e [DevTools] [Context] Legacy Context (#16617)
* Added hasLegacyContext check.

* Passed hasLegacyContext as prop to SelectedElement

* Changing context labels based on hasLegacyContext

* Fixed flow types.

* Fixed typos.

* Added tests for hasLegacyContext.

* Renamed test.

* Removed test imports.
2019-09-10 13:30:20 -07:00
Liad Yosef
c317fc273b Correct link for troubleshooting react-dev-tools (#16690) (#16708)
* Correct link for troubleshooting react-dev-tools (#16690)

As pointed out in #16690 - the link for 'React Tab Doesn't Show Up' points to the empty README.MD.
This points it to that section in the v3 version README.MD - until an updated section will be added to the new dev-tools.

* Add a "The React Tab Doesn't Show Up" section

Add the troubleshooting section to the react dev tools readme

* point to the correct section in react-dev-tools readme

After adding the troubleshooting section to the readme - this will point to the correct place

* Moved README file to GitHub

* Update new issue link to include DevTools label
2019-09-10 13:14:19 -07:00
Nicolas Gallagher
41a78cd85c [react-events] Tap: add maximumDistance prop (#16689)
A prop for configuring the maximum distance that the active pointer can move before the tap is cancelled.
2019-09-10 12:52:43 -07:00
Dan Abramov
2400400788 react-refresh@0.4.2 2019-09-10 20:46:34 +01:00
Dan Abramov
ba6bb0fccf [Fresh] Hash signatures (#16738) 2019-09-10 20:28:13 +01:00
Dominic Gannaway
fd3e8cb0ae [react-events] Remove stopPropagation (Press) + use document for delegation (#16730) 2019-09-10 20:31:24 +02:00
Heaven
38c03ce006 Fix typo in commet (#16727) 2019-09-10 10:27:38 -07:00
Hristo Kanchev
4905590e1e Fixed font family issue in FF. (#16701) 2019-09-09 16:21:04 -07:00
Daniel Lo Nigro
35f447ddbf Remove console.log from copyWithSet (#16716) 2019-09-09 16:18:09 -07:00
Sebastian Markbåge
440cbf2ee5 Let's schedule the passive effects even earlier (#16714)
It turns out I needed to schedule mine in the mutation phase and there
are also clean up life-cycles there.
2019-09-09 15:06:03 -07:00
Sebastian Markbåge
cc2492ccf1 Schedule passive callbacks before layout effects are invoked (#16713) 2019-09-09 13:34:57 -07:00
Nicolas Gallagher
031eba789f [react-events] Tap: change order of events (#16694)
Before:

start -> change -> update -> end (cancel) -> change

Now:

start -> change -> update -> change -> end (cancel)
2019-09-09 09:08:17 -07:00
Nicolas Gallagher
f26fe8c0a7 [react-events] Keyboard: fix callback return types (#16693) 2019-09-09 09:07:42 -07:00
Heaven
9444c876d5 Remove wrong copy-paste code in test (#16695) 2019-09-09 11:34:08 +01:00
Dan Abramov
b260bef398 [Fresh] Add skipEnvCheck option to Babel plugin (#16688) 2019-09-06 20:30:16 +01:00
Dan Abramov
2f15881859 react-refresh@0.4.1 2019-09-06 20:02:43 +01:00
Dan Abramov
9044bb0fa3 [Fresh] Fix a crash with implicit arrow return (#16687) 2019-09-06 19:58:07 +01:00
Dan Abramov
21d79ce040 Add FreshRuntime WWW bundle, remove ESLint (#16684) 2019-09-06 16:48:07 +01:00
Alex Rohleder
206d61f722 fix typos on react-devtools comments (#16681) 2019-09-06 07:47:44 -07:00
Heaven
61836fba2a Fix typo: wnless -> unless (#16680) 2019-09-06 07:47:35 -07:00
Sebastian Markbåge
e11bf42cea Check for Suspense boundary in a root Container (#16673)
If we find a Container that might mean that we're on a node that is inside
a Suspense boundary that is directly inside the Container root.

Imagine the div is a Container and the span is a dehydrated instance:

```
<div>
  <!--$-->
  <span />
  <!--/$-->
</div>
```

There's no way to tests this yet since I'm not actually utilizing
the return value yet.

The solution is to just use the same path to check for a Suspense boundary
as if we find a parent instance.
2019-09-05 16:06:05 -07:00
Dan Abramov
962dfc2c33 Remove experimental scheduler flags (#16672) 2019-09-05 20:08:06 +01:00
Nicolas Gallagher
ff006451ad [react-events] Fix isTargetWithinNode type (#16671)
isTargetWithinNode passes the childTarget to getClosestInstanceFromNode which
does not account for a null value of 'node'.
2019-09-05 11:36:31 -07:00
Dan Abramov
040ca0fad7 Enable MessageLoop implementation by default (#16408) 2019-09-05 19:25:51 +01:00
Brian Vaughn
d96f478f8a use-subscription tearing fix (#16623)
* Add (failing) subscription tearing test and bugfix
* Added more inline comments to test
* Simplified tearing test case slightly
2019-09-05 11:12:46 -07:00
Luna Ruan
79e46b6778 updated flags from false to dicated on www (#16647) 2019-09-05 09:51:44 -07:00
Sebastian Markbåge
8d7c733f1f [Partial Hydration] Don't invoke listeners on parent of dehydrated event target (#16591)
* Don't invoke listeners on parent of dehydrated event target

* Move Suspense boundary check to getClosestInstanceFromNode

Now getClosestInstanceFromNode can return either a host component,
host text component or suspense component when the suspense
component is dehydrated.

We then use that to ignore events on a suspense component.

* Attach the HostRoot fiber to the DOM container

This lets us detect if an event happens on this root's subtree before it
has rendered something.

* Add todo

The approach of checking isFiberMounted answers if we might be in an
in-progress hydration but it doesn't answer which root or boundary
might be in-progress so we don't know what to wait for.

This needs some refactoring.

* Refactor isFiberMountedImpl to getNearestMountedFiber

We'll need the nearest boundary for event replaying so this prepares for
that.

This surfaced an issue that we attach Hydrating tag on the root but normally
this (and Placement) is attached on the child. This surfaced an issue
that this can lead to both Placement and Hydrating effects which is not
supported so we need to ensure that we only ever use one or the other.

* Add todo for bug I spotted

* Cache tags

* Check the ContainerInstanceKey before the InstanceKey

The container is inside the instance, so we must find it before the
instance, since otherwise we'll miss it.
2019-09-05 08:51:31 -07:00
Nicolas Gallagher
9ce8711d5a [react-events] Tap responder (#16628)
This is a partial replacement for the 'Press' responder:

1. `useTap` is scoped to pointers (no keyboard support). Our current thinking is
that "responders" should be limited to working with pointers, and that they can
be combined with 'useKeyboard' in user-space. For example, we might create a
'usePress' hook in user-space that combines 'useTap' with 'useKeyboard' to react
to both pointers and keyboard interactions.

2. `useTap` cancels the gesture once the pointer moves over an element that is
not within the responder target's subtree. This differs from `usePress` (and
React Native), where the gesture remains active after the pointer exits the
target's subtree and is restarted once the pointer reenters. One of the
drawbacks with the `usePress` behavior is that it requires repeatedly measuring
DOM elements (which can cause jank) to perform hit region tests. `useTap` avoids
doing this and relies on `document.elementFromPoint` only to support the
TouchEvent fallbacks.

3. `useTap` calls `onTapUpdate` when the active gesture's state changes,
`onTapEnd` when the gesture successfully completes. and `onTapCancel` when it
fails. There is no `onTap` callback. `usePress` did not explicitly report back
when the gesture failed, and product developers were confused about the
difference between `onPress` and `onPressEnd`.

4. `useTap` explicitly separates the PointerEvent implementation from the
MouseEvent/TouchEvent fallback.

5. `useTap` has better unit test coverage . All pointer types and the fallback
environment are tested. The shape of the gesture state object is also defined
and tested.
2019-09-04 17:09:33 -07:00
Dominic Gannaway
e86146e714 [react-events] Refine executeUserEventHandler (#16662) 2019-09-05 00:36:29 +01:00
Dominic Gannaway
c66edb9f8b [react-events] Refactor getCurrentTarget to getResponderNode (#16660) 2019-09-04 20:04:35 +01:00
Dominic Gannaway
9ff60ff16b [react-events] Fix Scope listener issue (#16658) 2019-09-04 18:57:39 +01:00
Dominic Gannaway
7126a37bf4 [react-events] Keyboard responder propagation handling (#16657) 2019-09-04 18:25:05 +01:00
Dominic Gannaway
539640d89f [react-events] Various core tweaks for event responder system (#16654) 2019-09-04 18:05:56 +01:00
Dominic Gannaway
af032764a9 [react-events] Adds preventKeys support to Keyboard responder (#16642) 2019-09-04 01:38:36 +01:00
Brian Vaughn
f705e2bac7 Updated pending CHANGELOG for DevTools 2019-09-03 08:37:12 -07:00
Hristo Kanchev
77bb102398 [DevTools] [Profiler]: Save profile now working in Firefox (#16612)
* Added anchor dom element in order to successfully download profiling data.
* Reworked downloadFile to accept a DOMElement in order for FF to successfully download profiling data.
* Prettify downloadFile changes.
2019-09-03 08:35:12 -07:00
Heaven
92f094d86d fix typo: oncurrent - concurrent (#16633) 2019-09-02 11:21:48 +01:00
Dominic Gannaway
46f912fd57 [react-core] Add more support for experimental React Scope API (#16621) 2019-08-30 18:27:14 +01:00
Paul O’Shannessy
2c1e6bf619 Adopt Contributor Covenant (#16613)
In order to foster healthy open source communities, we're adopting the
[Contributor Covenant](https://www.contributor-covenant.org/). It has been
built by open source community members and represents a shared understanding of
what is expected from a healthy community.
2019-08-29 16:04:47 -07:00
Brian Vaughn
f962feb882 Updated extensions build-from-source instructions in README 2019-08-29 08:49:08 -07:00
Simen Bekkhus
ac6193687f add integrity field in yarn.lock (#16601) 2019-08-29 16:36:02 +01:00
Sebastian Silbermann
16329bd954 chore: Update nvmrc with latest lts (#16610) 2019-08-29 16:30:35 +01:00
Dominic Gannaway
4e544cffee [react-events] Split out mixed event responder tests (#16608) 2019-08-29 16:13:37 +01:00
Gerald Monaco
f61138e068 Use renderToStaticMarkup for tests (#16516) 2019-08-29 16:08:38 +01:00
James George
980112b146 rephrase comment (#16559) 2019-08-29 14:51:07 +01:00
Bas Peeters
8a7c2e50f1 Remove duplicate character in regex group (#16572) 2019-08-29 14:49:27 +01:00
Tom Quirk
557d472fe3 add <thead>, <tfoot> to table > tr warning (#16535) 2019-08-29 14:46:27 +01:00
Simen Bekkhus
37fcd04681 chore: upgrade to danger 9 (#16602) 2019-08-29 13:46:53 +01:00
Dominic Gannaway
bd79be9b68 [react-core] Add experimental React Scope component API (#16587) 2019-08-29 12:06:51 +01:00
Brian Vaughn
996acf9036 Updated DevTools extension build script to work when run remotely (#16603) 2019-08-28 17:01:26 -07:00
Dominic Gannaway
34aaec6f90 [react-events] Ensure screen reader virtual clicks support preventDefault (#16600) 2019-08-28 17:39:07 +01:00
Dan Abramov
01fb68b9bf Don't ignore dependencies for render phase update (#16574) 2019-08-28 16:55:56 +01:00
LEE SUK JAE
1b585f630b Fix link on error-codes/README.md (#16595) 2019-08-28 15:49:45 +01:00
Brian Vaughn
0f3e82f3c4 Merge branch 'devtools-v4-merge' 2019-08-28 07:39:49 -07:00
Brian Vaughn
b8390310b1 Revert "Import React DevTools v4"
This reverts commit b438699d36.
2019-08-28 07:39:32 -07:00
Brian Vaughn
b438699d36 Import React DevTools v4
Imports the entire React DevTools v4 git repository (with history).
2019-08-28 07:35:53 -07:00
Brian Vaughn
ada5991422 Removed an unnecessary/unused DT Flow type 2019-08-28 07:28:06 -07:00
Brian Vaughn
08ce280cbc Updated DT regression fixture path 2019-08-28 07:25:52 -07:00
Brian Vaughn
b034ac6d38 Merge branch 'master' into devtools-v4-merge 2019-08-28 07:13:49 -07:00
Luna Ruan
f512537754 Babel Transform JSX to React.jsx/React.jsxDEV Plugin (#16432)
This babel transform is a fork of the @babel/plugin-transform-react-jsx transform and is for experimentation purposes only. We don't plan to own this code in the future, and we will upstream this to Babel at some point once we've proven out the concept.

As per the RFC to simplify element creation, we want to change the JSX transform from targeting React.createElement(type, props, children) to React.jsx(type, props, key). This modifies the existing @babel/plugin-transform-react-jsx (and helper) babel plugin to support React.jsx and React.jsxDEV.

The main differences between React.jsx/React.jsxDEV and React.createElement are:
1.) key is now passed as an explicit argument rather than through props
3.) children are now passed through props rather than as an explicit argument
4.) props must always be an object
5.) __source and and __self are now passed as separate arguments into React.jsxDEV rather than through props

Part of the rationale for this change is that we want to deprecate key spread through props because this is an expensive dynamic comparison operation. We want users instead always explicitly pass key as a prop. However, in the interim, we need a way to distinguish between <div {...props} key={foo} /> and <div key={foo} {...props} />. Therefore, until we completely deprecate key spreading, we will use React.createElement to transform <div {...props} key="Hi" /> and React.jsx to transform everything else.
2019-08-27 16:00:20 -07:00
Nicolas Gallagher
cb15f18dc1 [react-events] Improve mock event object accuracy (#16590)
* Better simulation for pointercancel
* Fix pressure values for different pointers
* Add describe/test helpers for pointer events
2019-08-27 15:45:54 -07:00
Brian Vaughn
bc8b15332b Updated README docs, example screenshots, etc 2019-08-27 15:20:34 -07:00
Brian Vaughn
7153dd516f Fixed a StyleEditor variable resolution regression 2019-08-27 12:53:38 -07:00
Brian Vaughn
33d439f8fd Merge branch 'master' into devtools-v4-merge 2019-08-27 11:00:41 -07:00
Brian Vaughn
fb316787cb Removed unused Chrome Flow types 2019-08-27 10:54:21 -07:00
Brian Vaughn
8e1434e80e Added FB copyright header 2019-08-27 10:54:01 -07:00
Brian Vaughn
49b0f87d10 Suppress act/renderer warning for DevTools tests 2019-08-27 10:46:27 -07:00
Brian Vaughn
8c684bf7e1 Removed forked DevTools Flow types 2019-08-27 10:42:02 -07:00
Brian Vaughn
9a016c0c2b Removed outdated snapshot 2019-08-27 10:31:36 -07:00
Brian Vaughn
f55b4f8e28 CI runs DevTools tests against built source 2019-08-27 10:28:58 -07:00
Dominic Gannaway
4ef269606c [react-events] Support screen reader virtual clicks (#16584) 2019-08-27 17:32:50 +01:00
Brian Vaughn
892ca8137e Disabled DevTools tests from yarn-build target 2019-08-27 09:08:49 -07:00
Brian Vaughn
896c993ada Fixed remaining DevTools broken tests by fixing a hydration/spread bug 2019-08-27 08:50:36 -07:00
Brian Vaughn
e3cc42be97 Fix Console patching test by resetting modules 2019-08-26 13:53:29 -07:00
Brian Vaughn
177f357d9d Updated DevTools test setup to no longer mock test renerer 2019-08-26 13:46:00 -07:00
Brian Vaughn
a48593a8d3 Iterating on DevTools tests: Trying to run tests against pre-build react-dom and react-test-renderers 2019-08-26 13:43:09 -07:00
Brian Vaughn
ee4806f47a Fixed flushing problem with tests 2019-08-26 13:08:35 -07:00
Brian Vaughn
9d4fd7a249 Merged changes from 4.0.5 -> 4.0.6 from DevTools fork 2019-08-26 10:12:18 -07:00
Brian Vaughn
4c1514495b Merge branch 'source' of github.com:bvaughn/react-devtools-experimental 2019-08-26 10:06:00 -07:00
Brian Vaughn
13a93e7b82 Configured CI to run DevTools tests. Updated other test configs not to include DevTools tests. 2019-08-26 09:58:28 -07:00
Brian Vaughn
c00a920640 Merge branch 'master' into devtools-v4-merge 2019-08-26 09:42:25 -07:00
Brian Vaughn
0da7bd0604 React DevTools CHANGELOG entry for 4.0.6 2019-08-26 09:34:06 -07:00
Brian Vaughn
a39d9c3dff 4.0.5 -> 4.0.6 2019-08-26 08:42:38 -07:00
Brian Vaughn
1e3b0b520e Added a null check around memoizedProps 2019-08-24 09:04:26 -07:00
Brian Vaughn
84b492f344 Polyfill Symbol usage 2019-08-23 17:38:45 -06:00
Dominic Gannaway
fc80772078 [react-events] Ensure updateEventListeners updates in commit phase (#16540) 2019-08-22 23:58:16 +01:00
Dan Abramov
0f6e3cd61c [Scheduler] Profiler Features (second try) (#16542)
* Revert "Revert "[Scheduler] Profiling features (#16145)" (#16392)"

This reverts commit 4ba1412305.

* Fix copy paste mistake

* Remove init path dependency on ArrayBuffer

* Add a regression test for cancelling multiple tasks

* Prevent deopt from adding isQueued later

* Remove pop() calls that were added for profiling

* Verify that Suspend/Unsuspend events match up in tests

This currently breaks tests.

* Treat Suspend and Resume as exiting and entering work loop

Their definitions used to be more fuzzy. For example, Suspend didn't always fire on exit, and sometimes fired when we did _not_ exit (such as at task enqueue).

I chatted to Boone, and he's saying treating Suspend and Resume as strictly exiting and entering the loop is fine for their use case.

* Revert "Prevent deopt from adding isQueued later"

This reverts commit 9c30b0b695d81e9c43b296ab93d895e4416ef713.

Unnecessary because GCC

* Start counter with 1

* Group exports into unstable_Profiling namespace

* No catch in PROD codepath

* No label TODO

* No null checks
2019-08-22 13:58:12 -07:00
Nicolas Gallagher
474b650cac [react-events] Rename hook exports (#16533)
For example, 'useHoverResponder' becomes 'useHover'
2019-08-22 13:30:35 -07:00
Nicolas Gallagher
2f03aa6eed [react-events] Fix middle-click for Press (#16546)
Browsers always report 'buttons' as 0 when a pointer is released.
2019-08-22 10:22:14 -07:00
Bruno Scopelliti
16c3408638 Only warn in case the fourth argument is a function (#16543) 2019-08-22 17:31:27 +01:00
Sebastian Markbåge
05f5192e81 [Partial Hydration] Dispatching events should not work until hydration commits (#16532)
* Refactor a bit to use less property access

* Add test for invoking an event before mount

* Add Hydration effect tag

This is equivalent to a "Placement" effect in that it's a new insertion
to the tree but it doesn't need an actual mutation.

It is only used to determine if a subtree has actually mounted yet.

* Use the Hydration flag for Roots

Previous roots had a Placement flag on them as a hack for this case but
since we have a special flag for it now, we can just use that.

* Add Flare test
2019-08-22 08:46:20 -07:00
Brian Vaughn
bf9415834f Fixed outdated extension popup wording 2019-08-21 14:28:57 -07:00
Brian Vaughn
6dda816102 Remove emoji prefix from Firefox extension tab labels
Firefox adds these already for React, so the extra emoji character was confusing. For now, we still prepend it for Chrome
2019-08-21 14:23:51 -07:00
Brian Vaughn
79bda69d88 Renamed DevTools Jest config to be more concistent with others 2019-08-21 13:40:24 -07:00
Dan Abramov
8a01b50fc3 eslint-plugin-react-hooks@2.0.1 2019-08-21 21:40:20 +01:00
Dan Abramov
3ed289b3b1 Clear canceled task node early (#16403) 2019-08-21 19:49:22 +01:00
Dan Abramov
0672829053 Bump ESLint plugin to 2.0 (#16528) 2019-08-21 19:14:34 +01:00
Nicolas Gallagher
2559111c21 [react-events] Rely on 'buttons' rather than 'button' (#16479)
The semantics of 'button' on events differs between PointerEvent and
MouseEvent, whereas they are the same for 'buttons'. Furthermore, 'buttons'
allows developers to determine when multiple buttons are pressed as the same
time.

https://w3c.github.io/pointerevents/#the-button-property
2019-08-21 10:07:15 -07:00
Dan Abramov
c433fbb593 Revert "Revert "[ESLint] Forbid top-level use*() calls (#16455)"" (#16525)
* Revert "Revert "[ESLint] Forbid top-level use*() calls (#16455)" (#16522)"

This reverts commit 507f0fb372.

* Update RulesOfHooks.js
2019-08-21 15:43:31 +01:00
Brian Vaughn
66c9fedc34 Flow fixes 2019-08-20 13:33:33 -07:00
Brian Vaughn
fe943c339d Add custom DevTools Flow definitions to shared flowconfig 2019-08-20 11:37:45 -07:00
Brian Vaughn
2e549efae5 Moved DevTools custom Flow definitions 2019-08-20 11:37:31 -07:00
Brian Vaughn
4da836af71 Merged changes from 4.0.0 -> 4.0.5 from DevTools fork 2019-08-20 11:34:51 -07:00
Brian Vaughn
3ad50710a7 Merge branch 'source' of github.com:bvaughn/react-devtools-experimental 2019-08-20 11:00:02 -07:00
Brian Vaughn
833f206348 Merge branch 'master' into devtools-v4-merge 2019-08-20 10:41:38 -07:00
Brian Vaughn
2843a1556e Fixed invalid object-assign version (4.0.4 -> 4.0.1) 2019-08-20 09:45:09 -07:00
Brian Vaughn
aa56fe34ac Improved GitHub issue repro instructions prompt 2019-08-20 09:44:41 -07:00
Brian Vaughn
5441b094a4 4.0.4 -> 4.0.5 2019-08-19 09:26:55 -07:00
Brian Vaughn
01b1e7e2cf Alpha-sort props/state/context keys 2019-08-19 09:17:52 -07:00
Brian Vaughn
d2456c7572 Fixed standalone target not properly serving backend over localhost:8097 2019-08-19 07:36:41 -07:00
Brian Vaughn
14c2eab7c3 Resolved Yarn conflict for object-assign 2019-08-19 07:04:47 -07:00
Brian Vaughn
3c6a219466 4.0.3 -> 4.0.4 2019-08-18 08:45:52 -07:00
Brian Vaughn
4697f5b379 Profiler bugfix for filtering out all commits after selecting a fiber 2019-08-18 08:34:40 -07:00
Brian Vaughn
95ca079556 Fixed standalone bug that prevented backend from being served over localhost:8097 2019-08-17 21:11:10 -07:00
Brian Vaughn
95ffd3ccf8 4.0.2 -> 4.0.3 2019-08-17 11:31:31 -07:00
Brian Vaughn
2935d6a18d Unserializable data type fix for standalone shell 2019-08-17 11:31:20 -07:00
Brian Vaughn
ce65df7092 Added support for unserializable types (e.g. Set/Map, Immutable) 2019-08-17 10:20:26 -07:00
Brian Vaughn
f66a20f439 Caps lock bug template request for repro steps :) 2019-08-16 14:47:55 -07:00
Brian Vaughn
69b2ecc531 Added explicit (empty) label next to empty arrays and objects 2019-08-16 13:47:09 -07:00
Brian Vaughn
024bac4263 Support single-quote strings in style editor 2019-08-16 13:35:30 -07:00
Brian Vaughn
74f4a3f972 Improved editing props demo experience for TODO list 2019-08-16 13:15:16 -07:00
Brian Vaughn
f616613059 Display hook values for components that only use context 2019-08-16 11:33:28 -07:00
Brian Vaughn
454157dd66 Multi-renderer profiling improvements
Add support for mixed v15/v16 renderers that previously caused profiling to fail with 'profiling not supported by this renderer' type errors
2019-08-16 11:25:44 -07:00
Brian Vaughn
49399aa3e7 Prettier 2019-08-16 09:05:26 -07:00
Brian Vaughn
5e043adba7 Added Set+Map to dev shell, even though we don't support deep inspecting them yet 2019-08-16 09:05:21 -07:00
Brian Vaughn
2bcc6c6d04 4.0.1 -> 4.0.2 2019-08-15 17:35:30 -07:00
Brian Vaughn
527fc4a63f Refactored to remove need for new webNavigation permission 2019-08-15 17:34:34 -07:00
Brian Vaughn
c100cc7b31 4.0.0 -> 4.0.1 2019-08-15 16:29:13 -07:00
Brian Vaughn
545de6f02e Removed some unnecessary manifest permissions 2019-08-15 16:28:10 -07:00
Brian Vaughn
d0dcbe5594 Changed version name string to show version and date. Moved commit number into description string. 2019-08-15 14:38:16 -07:00
Brian Vaughn
0763c48ed8 Bumped all versions to 4.0.0 2019-08-15 14:28:09 -07:00
Brian Vaughn
732f3a6ef1 4.0.0-alpha.9 -> 4.0.0-alpha.10 2019-08-15 11:26:04 -07:00
Brian Vaughn
db9e5c9715 Updated all GitHub links to point to React repo 2019-08-15 11:17:59 -07:00
Brian Vaughn
85fbe3be3f Merge branch 'master' into devtools-v4-merge 2019-08-15 10:14:34 -07:00
Brian Vaughn
7ce229d3b0 Made some incremental progress on Jest tests 2019-08-15 09:53:22 -07:00
Brian Vaughn
4c4f5fd27f Disable @babel/plugin-transform-block-scoping "throwIfClosureRequired" option for tests 2019-08-14 19:04:43 -07:00
Brian Vaughn
41db902ed4 Removed unused __TEST__ files 2019-08-14 19:03:32 -07:00
Brian Vaughn
a6aba5a587 Add explicit MIT license file (previously only in package.json) 2019-08-14 17:04:05 -07:00
Brian Vaughn
9ec9938ff4 print-warnings script should ignore DevTools packages 2019-08-14 14:02:12 -07:00
Brian Vaughn
a473dca59e Merge branch 'master' into devtools-v4-merge 2019-08-14 14:01:46 -07:00
Brian Vaughn
4078167255 Removed (no longer necessary) node->node-events mapping 2019-08-14 11:43:59 -07:00
Brian Vaughn
d7ca8847f5 Add build-info.json to package files array for non-private DT packages 2019-08-14 11:40:09 -07:00
Brian Vaughn
39209dc5b5 Update react-devtools-inline to embed react-debug-tools since it's not published yet 2019-08-14 11:37:48 -07:00
Brian Vaughn
45dff31a75 Patched up react-devtools-core Webpack configs 2019-08-14 11:22:28 -07:00
Brian Vaughn
58b39c60db Fixed web extensions 2019-08-14 10:33:33 -07:00
Brian Vaughn
30b8ef3756 Iterated on Webpack configs until I got the inline and shell packages seemingly working 2019-08-14 09:24:35 -07:00
Brian Vaughn
44e410900d Merged master (with events -> legacy-events package rename) 2019-08-14 07:35:49 -07:00
Brian Vaughn
441d014cef Cleaned up some extnesions build script stuff 2019-08-13 22:15:38 -07:00
Brian Vaughn
380da5fccc Moved OVERVIEW 2019-08-13 22:09:20 -07:00
Brian Vaughn
b73e293cc5 Moved CHANGELOG 2019-08-13 22:05:45 -07:00
Brian Vaughn
ac2e861fbe Fixed a bunch of Lint issues 2019-08-13 21:59:07 -07:00
Brian Vaughn
51626ae2f9 Prettier 2019-08-13 18:12:19 -07:00
Brian Vaughn
f7afe1b864 Moved shell fixture into packages/react-devtools-shell 2019-08-13 18:11:59 -07:00
Brian Vaughn
183f96f2ac Prettier 2019-08-13 17:58:03 -07:00
Brian Vaughn
edc46d7be7 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
08743b1a8e Reorganized folders into packages/* 2019-08-13 15:59:43 -07:00
Brian Vaughn
ec7ef50e8b Reorganized things again into packages 2019-08-13 11:37:25 -07:00
Brian Vaughn
7cabb3946e Reorganized fixtures 2019-08-13 11:11:25 -07:00
Brian Vaughn
c8922c3dbf Updated yarn.lock file 2019-08-13 11:08:40 -07:00
Brian Vaughn
9c825b59f1 Moved dev shell into fixtures/devtools 2019-08-13 11:05:37 -07:00
Brian Vaughn
65b93cd165 Merge remote-tracking branch 'devtools-merge/master' into devtools-v4-merge 2019-08-13 10:46:18 -07:00
Brian Vaughn
56b1c20cf0 Reorganized to avoid merge conflicts with React repo folder structure 2019-08-13 10:33:56 -07:00
Brian Vaughn
e3ac9d219d Merging DevTools fork 2019-08-13 10:10:41 -07:00
Brian Vaughn
848327760f Initializing empty merge repo 2019-08-13 10:09:17 -07:00
Brian Vaughn
6eb04b2b16 4.0.0-alpha.8 -> 4.0.0-alpha.9 2019-08-12 11:34:00 -07:00
Brian Vaughn
2f1c100e7c Misc. Profiler tweaks
* Disabled (with a follow up TODO) the  call in the reload-and-profile toggle.
* Disabled reload-and-profile in Firefox extension for now, since it was triggering a disconnected port error.
* Fixed Safari layout bug that caused profiler charts to be hidden.
2019-08-12 11:13:38 -07:00
Brian Vaughn
8fa608d9ab Fixed a selection-sync edge case for Elements/Components tabs 2019-08-12 10:31:50 -07:00
Brian Vaughn
8001b6432c Fixed raw-loader + Jest problem 2019-08-12 08:49:26 -07:00
Brian Vaughn
b5195a5f16 Fixed a couple of edge case styling and layout issues I noticed while testing the inline target 2019-08-12 08:26:48 -07:00
Brian Vaughn
2eb3f4e9b8 README typofix 2019-08-06 10:45:16 -07:00
Brian Vaughn
2015a39c2e 4.0.0-alpha.7 -> 4.0.0-alpha.8 2019-08-06 10:22:12 -07:00
Brian Vaughn
e015e3d937 Added not about sync/batched root API being required 2019-08-06 08:57:34 -07:00
Brian Vaughn
2349f04478 Handle case where :root styles aren't (yet) applied when SettingsContext mounts
This fixes a possible bug in the inline shell where line-heights are NaN so the Tree (react-window List) gets created with a itemSize of NaN
2019-08-06 08:46:42 -07:00
Brian Vaughn
baac1dcc52 Inline package tweaks:
* Ignore messages from the DevTools browser extension.
* Cleanup/clarify README
2019-08-05 14:00:18 -07:00
Brian Vaughn
dc8580e64d New NPM package react-devtools-inline (#363) 2019-08-05 10:09:26 -07:00
Sam Horton
6f1e283b76 feat: match HOC display names during search (#360)
* feat: match HOC display names during search

* chore: update tests for new search logic
2019-08-05 09:44:48 -07:00
Brian Vaughn
6b3ae64598 Suppress known/expected warnings and errors in local DEV shell 2019-08-04 14:33:38 -07:00
Brian Vaughn
db8542ad97 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
Dominic Gannaway
644c9c4e1c [Flare] useListener -> useResponder (#362) 2019-08-02 10:14:25 -07:00
Brian Vaughn
9727f4e88f Don't let a DevTools or React internal error interfere with logging. 2019-08-02 09:39:39 -07:00
Brian Vaughn
abbaedd264 Updated Flow type for DevTools tab id 2019-08-02 09:27:13 -07:00
Brian Vaughn
62e5fd57a1 NPM package versions 4.0.0-alpha.5 -> 4.0.0-alpha.6 2019-08-01 08:26:32 -07:00
Brian Vaughn
51a15e0e4d Added CHANGELOG entries for HOC badges and no in-line props 2019-08-01 07:56:10 -07:00
Brian Vaughn
aed31fdf12 Element keys are selectable text
Changed truncation to be CSS-driven, and enabled double-click selection of text, so that long keys could be copied from within the tree.
2019-07-31 14:48:39 -07:00
Brian Vaughn
11e7b1d290 Updated OVERVIEW doc 2019-07-31 14:22:43 -07:00
Brian Vaughn
e4ccafc099 Updated CHANGELOG based on Dan's feedback 2019-07-31 14:08:44 -07:00
Brian Vaughn
52b0c20a62 Added dynamic indentation to change log 2019-07-31 13:44:32 -07:00
Brian Vaughn
271aa75cf2 Removed the Profiler screenshot capture feature
This wasn't reliable because of browser extension API limitations and required serious throttling to avoid harming performance, so I've decided to just remove it entirely for now.
2019-07-31 11:36:01 -07:00
Brian Vaughn
4f8b7864ee 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
c57d2a2901 Added CHANGELOG 2019-07-31 10:50:56 -07:00
Brian Vaughn
9a36e56d34 Added missing Flow header 2019-07-28 17:21:00 -07:00
Brian Vaughn
8e2134beee Re-add try/catch inside Agent's getIDForNode() 2019-07-28 08:42:21 -07:00
Philipp Spiess
82881ab261 Allow Inspecting Elements Within Iframes (#355)
This change adds support for element inspecting within `<iframe/>`s.

The iframes are kept in a Set so that we only append listeners once and
clean them up properly. I’ve run a few tests and it seems to behave as
expected.

The fixture includes a cross-origin iframe to make sure we do not error
in this case.
2019-07-28 08:40:02 -07:00
Brian Vaughn
50512a223b Reverted a Webpack config change that broke browser extension styles 2019-07-27 09:30:23 -07:00
Brian Vaughn
ca4aac5014 Tweaked recent search changes
1. Compare element indices rather than ids (since these don't necessarily correlate)
2. Restored previous behaior when new search text reduces the number of results past the currently-selected element.
2019-07-27 09:15:53 -07:00
Fanny
29a6bf2a7b Feature: tweak search behaviour (#353)
Merge PR #353 from @fanny

This change changes search beahvior to initially select the result nearest the currently selected element (rather than selecting the first result in the set).
2019-07-27 09:04:20 -07:00
Brian Vaughn
3b2905b690 NPM package versions 4.0.0-alpha.4 -> 4.0.0-alpha.5 2019-07-26 10:13:52 -07:00
Brian Vaughn
7385de9fc2 react-devtools-core standalone bugfix: prevent electron crash
CSS source maps require the style-loader to use URL.createObjectURL (rather than just a <style> tag). For some reason, this crashes Electron's webview process, which completely breaks the embedded extension inside of Nuclide and other Electron apps. This commit turns (CSS) source maps off for production builds to avoid this crash.
2019-07-26 10:13:07 -07:00
Brian Vaughn
76c67399db Re-enabled packages backend build to be production mode (whoops) 2019-07-25 15:10:30 -07:00
Brian Vaughn
050cb8452d 4.0.0-alpha.3 -> 4.0.0-alpha.4 2019-07-25 10:26:52 -07:00
Brian Vaughn
1e8aa8105a 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
c6fb743910 Flow type cleanup 2019-07-25 09:13:45 -07:00
Dominic Gannaway
a7948e8342 [Flare] Remove the old EventComponent/EventTarget system (#354) 2019-07-25 08:45:59 -07:00
Brian Vaughn
270f34f7f0 Support new Flare hook, unstable_useListener 2019-07-25 08:21:41 -07:00
Brian Vaughn
8d1c829019 Reverted style-prop hiding change because it caused a regression in the browser extension 2019-07-24 15:48:48 -07:00
Brian Vaughn
c7aff5503f 4.0.0-alpha.2 -> 4.0.0-alpha.3 2019-07-24 14:46:53 -07:00
Brian Vaughn
2e8b9fad36 Make style editor inputs more obvious resemble inputs 2019-07-24 14:43:29 -07:00
Brian Vaughn
4c610950a4 Hide "style" prop if we are showing the style editor
Also add react-native-web to test harness
2019-07-24 14:05:56 -07:00
Brian Vaughn
9a05e0b600 Disable view-source button in standalone mode if no project roots are provided 2019-07-24 13:36:51 -07:00
Brian Vaughn
722d366e9f Updated snapshot 2019-07-24 11:27:15 -07:00
Brian Vaughn
56b0017615 4.0.0-alpha.1 -> 4.0.0-alpha.2 2019-07-24 11:25:52 -07:00
Brian Vaughn
f74c89b145 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 Vaughn
13959aa8fb Removed accidental log statement 2019-07-24 11:13:30 -07:00
Brian Vaughn
1178d57257 Fixed a module resolution issue and a syntax error from a bad merge 2019-07-23 07:46:19 -07:00
Brian Vaughn
ffb19346c7 NPM packages 4.0.0-alpha.0 -> 4.0.0-alpha.1 2019-07-22 11:19:53 -07:00
Brian Vaughn
4b34a77d29 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
39ad101ea2 Removed reference to setDefaultThemeName() method
This functionality was added to v3 to support external changing of theme at runtime. This isn't supported in v4.
2019-07-20 09:28:09 -07:00
Brian Vaughn
33da657178 Make console override detectable (for RN YellowBox) 2019-07-20 08:05:08 -07:00
Brian Vaughn
167daf7a4a Updating NPM packages as 4.0.0-alpha.0 2019-07-19 10:09:49 -07:00
Brian Vaughn
abe75b0e39 Slight tweak to avoid setting an invalid numeric value in props editor 2019-07-19 09:19:03 -07:00
Brian Vaughn
f0a4b2f8e8 Merge branch 'fix-input-number-in-props' of https://github.com/koba04/react-devtools-experimental into koba04-fix-input-number-in-props 2019-07-19 09:16:26 -07:00
Brian Vaughn
0abaefb7c2 Cleanup legacy backend event listener if modern backend is detected 2019-07-19 09:02:30 -07:00
Brian Vaughn
dbbf30a332 Make my code PRETTIER 2019-07-18 16:37:57 -07:00
Brian Vaughn
67e749a73a Tweaked modal font size style 2019-07-18 16:28:20 -07:00
Brian Vaughn
bd0a0c58fd Tweaked modal title to better fit without wrapping 2019-07-18 16:26:27 -07:00
Brian Vaughn
249a2e043d Detect React Native v3 backend and show warning 2019-07-18 16:24:22 -07:00
Brian Vaughn
9fb753b5cd Hardened logic around when and how to patch console methods 2019-07-17 15:08:34 -07:00
Brian Vaughn
cb3fb42129 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
Toru Kobayashi
41c00cb0cb fix to input a number value to props 2019-07-14 23:11:08 +09:00
Brian Vaughn
0f2fb5badf 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
Brian Vaughn
39a811debe Merge pull request #342 from marvinhagemeister/attach_configure
Fix reload-and-profile attach not configurable
2019-07-06 18:40:00 -04:00
Marvin Hagemeister
8e90194f7d Add comment about 3rd party integrations 2019-07-01 23:48:52 +02:00
Marvin Hagemeister
5ec387aa82 Mark reload-and-profile attach as configurable 2019-07-01 23:35:35 +02:00
Brian Vaughn
844cdb22d6 Merge pull request #331 from trueadm/flare_displayName
[Flare] Update event component displayName
2019-06-24 07:48:24 -07:00
Brian Vaughn
81e5e9be0b Updated @reach/tooltip to v0.2.2 for a bugfix 2019-06-19 15:43:15 -07:00
Brian Vaughn
35600be1da Changed Chrome manifest version from 4.0.0.0 to 4.0.0 2019-06-19 11:06:36 -07:00
Dominic Gannaway
89a0886872 [Flare] Update event component displayName 2019-06-19 17:43:15 +01:00
Brian Vaughn
083bf8d98b Don't try to convert absolute paths to relative 2019-06-18 18:40:05 -07:00
Brian Vaughn
0e4005e0a1 Added command to build Chrome CRX 2019-06-18 15:44:22 -07:00
Brian Vaughn
abc8ef3d5d Display unnamed custom hooks as 'Anonymous' 2019-06-18 11:37:29 -07:00
Brian Vaughn
a2c79f2d9e Fixed hydration for events meta data 2019-06-18 10:50:19 -07:00
Brian Vaughn
cf19916be7 Tweaked overflow check 2019-06-18 08:59:27 -07:00
Brian Vaughn
46def793de Merge branch 'when-render-hidden' of https://github.com/justingrant/react-devtools-experimental into justingrant-when-render-hidden 2019-06-18 08:52:08 -07:00
Brian Vaughn
3988c27d70 Merge pull request #325 from bvaughn/hydration
Lazily send props/state/hooks across the bridge
2019-06-18 08:50:21 -07:00
Brian Vaughn
6298fd4248 Hardened the hooks dehydration check 2019-06-18 08:47:37 -07:00
Brian Vaughn
a56fd4c36d Tidied up. Added comments. Renamed a few things. 2019-06-18 08:40:58 -07:00
Brian Vaughn
8e3cd8ab1e Debounce inspect-element polling 2019-06-18 07:41:30 -07:00
Brian Vaughn
6c03f6abbd Tidied up a bit 2019-06-17 14:49:19 -07:00
Brian Vaughn
717af9f5c3 Updated the hydration test harness to cover a bit more 2019-06-17 14:37:49 -07:00
Brian Vaughn
d3d8a5d8b1 Hooks hydrate/dehydrate 2019-06-17 14:30:34 -07:00
Brian Vaughn
7a94ad4e8a Added props/state/context inspection to KeyValue 2019-06-17 11:30:53 -07:00
Brian Vaughn
a6d3f30f95 Initial support for hydration added to both renderer interfaces. 2019-06-16 17:32:37 -07:00
Justin Grant
a15f776708 fix: ensure when-rendered content is never hidden 2019-06-15 09:24:37 -07:00
Brian Vaughn
5e8678a0a9 Don't send HTMLElements through the bridge when inspecting componetns 2019-06-13 09:09:31 -07:00
Brian Vaughn
9eb6d3465d Updated React version check to account for older (<15) versions 2019-06-12 18:56:39 -07:00
Brian Vaughn
96f7646a1a Updated hydration logic to handle custom objects 2019-06-12 15:43:15 -07:00
Brian Vaughn
cb10c3d6da Lintfix 2019-06-12 15:17:29 -07:00
Brian Vaughn
f6ec82553d Support toggling Suspense from within owners list 2019-06-12 15:13:51 -07:00
Brian Vaughn
f0a29984f4 Merge pull request #320 from gaearon/own
Fix owner tree for legacy backend
2019-06-12 09:58:17 -07:00
Dan
4bfabbc32b Fix owner tree for legacy backend 2019-06-12 17:56:25 +01:00
Brian Vaughn
2e40cc4b18 Merge pull request #319 from gaearon/legacy-fix
Fix some legacy backend bugs
2019-06-12 09:36:20 -07:00
Dan
fdf753021e Distinguish functions and classes 2019-06-12 17:23:29 +01:00
Dan
3137553f6d State and context are on the public instance 2019-06-12 16:50:15 +01:00
Dan
f352fe2625 Maintain rootID for lazily crawled trees 2019-06-12 16:38:35 +01:00
Dan
b5850fe304 Ignore SSR mounts 2019-06-12 16:15:58 +01:00
Brian Vaughn
6c8ae706ee Merge pull request #316 from gaearon/lighter
Make children selection lighter
2019-06-11 07:13:01 -07:00
Dan Abramov
3bca6b28cd Make children selection lighter 2019-06-10 20:10:24 -06:00
Brian Vaughn
a08e9279ec Merge pull request #315 from bvaughn/settings
Settings panel inlined
2019-06-10 15:44:23 -07:00
Brian Vaughn
dd748ef574 Moved logic to only send updated filters across Bridge to the Store (and added tests) 2019-06-10 15:36:29 -07:00
Brian Vaughn
91e3f6cd4d Removed console.log 2019-06-10 15:05:12 -07:00
Brian Vaughn
e2e598c824 Remember last preferences tab via local storage 2019-06-10 15:03:05 -07:00
Brian Vaughn
19ed98d0c2 Removed Settings panel in favor of new shared Settings modal 2019-06-10 14:57:26 -07:00
Brian Vaughn
402a68d816 Fixed minor border bug in Profiling tab toolbar 2019-06-10 11:14:27 -07:00
Brian Vaughn
37c331533d Merge pull request #173 from bvaughn/legacy
Support legacy React versions
2019-06-09 16:24:00 -07:00
Brian Vaughn
e66fcaf17d Nit 2019-06-09 16:22:23 -07:00
Brian Vaughn
8f53235017 Fixed regression fixtures 2019-06-09 16:16:06 -07:00
Brian Vaughn
80bf1ba0eb Merge branch 'master' into legacy 2019-06-09 16:00:12 -07:00
Brian Vaughn
ea03ddd583 Added Flow type coverage for all EventEmitter subclasses 2019-06-09 15:50:17 -07:00
Brian Vaughn
b3046c6e19 Merge pull request #310 from bvaughn/track-changed-props
Add profiling option to track why a component rendered
2019-06-08 17:45:46 -07:00
Brian Vaughn
3904d634bb Added an explicit 'did not render' label 2019-06-08 17:36:17 -07:00
Brian Vaughn
341d1574cb Tweaked a few inline comments 2019-06-08 17:30:11 -07:00
Brian Vaughn
9047f371e2 Fix minor toolbar border misalignment 2019-06-08 17:18:05 -07:00
Brian Vaughn
4f92af17ea Only show "rendered at" if selected Fiber committed at least once 2019-06-08 17:17:56 -07:00
Brian Vaughn
7a72ee5ac0 Added context changes to sidebar; fixed a initial-mount detection bug 2019-06-08 17:01:38 -07:00
Brian Vaughn
5672d686dc Fixed some minor CSS issues 2019-06-08 16:45:38 -07:00
Brian Vaughn
6ab522326d Added a test for added/removed props 2019-06-08 11:41:39 -07:00
Brian Vaughn
a2f469d742 Fixed an increment bug in sidebar for fiber-commits 2019-06-08 09:22:30 -07:00
Brian Vaughn
2d48401346 Added context support to change description 2019-06-08 09:10:54 -07:00
Dan Abramov
fdc5ca4ba6 Remove dead code 2019-06-07 18:42:12 -07:00
Dan Abramov
90fa0adc0a Fix lint 2019-06-07 18:37:24 -07:00
Dan Abramov
65ac53bba4 Fixes 2019-06-07 18:33:03 -07:00
Dan Abramov
ad7458bb42 Merge branch 'master' into legacy 2019-06-07 17:54:54 -07:00
Dan Abramov
9243bc194c Rewrite to make it sturdier 2019-06-07 17:21:30 -07:00
Brian Vaughn
bd5c2e4621 Initial change tracking implemented
* User profiling setting
* Background collects changed props/state (not added/removed or hooks yet)
* Tests updated
2019-06-07 15:38:26 -07:00
Brian Vaughn
88e59277e7 Added HOC badges to Jest Store serialization 2019-06-07 14:10:49 -07:00
Brian Vaughn
21bb66a8c7 Added HOC filter test 2019-06-07 14:06:08 -07:00
Brian Vaughn
956935f915 Merge pull request #308 from bvaughn/dependabot/npm_and_yarn/js-yaml-3.13.1
Bump js-yaml from 3.12.1 to 3.13.1
2019-06-07 13:15:10 -07:00
dependabot[bot]
c2c3e8e6e5 Bump js-yaml from 3.12.1 to 3.13.1
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.12.1 to 3.13.1.
- [Release notes](https://github.com/nodeca/js-yaml/releases)
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/3.12.1...3.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2019-06-07 20:12:54 +00:00
Brian Vaughn
78721bde4c Backend notifies the frontend of Storage API support. Frontend disables e.g. reload-and-profile based on this. 2019-06-07 13:08:49 -07:00
Brian Vaughn
3e3c83aecd Updated reload-and-profile temp key to use sessioStorage instead of localStorage 2019-06-07 12:40:59 -07:00
Brian Vaughn
89e36e3976 Wrap all calls to localStorage/sessionStorage to avoid potential runtime errors 2019-06-07 10:51:01 -07:00
Brian Vaughn
a987206a36 Fixed an overflow bug. Added mode-specific CSS style for Firefox. 2019-06-06 10:39:07 -07:00
Brian Vaughn
d1a88ffc5c Re-add plugin-transform-react-jsx-source plugin for tests 2019-06-05 14:36:01 -07:00
Brian Vaughn
dc9b0810f9 Changed react-window alias 2019-06-05 14:33:24 -07:00
Brian Vaughn
9d90189ee3 react-window sync flushes scroll updates 2019-06-05 14:30:43 -07:00
Brian Vaughn
6ff733873c Vendored react-window 2019-06-05 14:27:57 -07:00
Brian Vaughn
7ef5970b2f Removed __source info from production builds 2019-06-04 17:03:13 -07:00
Brian Vaughn
1afc83e7cd Tweaked manifest "version_name" logic 2019-06-04 14:56:36 -07:00
Sarhan Aissi
e158768b16 fix: remove version_name from Firefox WebExtension manifest 2019-06-04 22:34:20 +01:00
Brian Vaughn
7ed3f6815c Merge pull request #295 from bvaughn/horizontal-compression
Components tree changes to improve HOCs and browsing deep trees
2019-06-04 13:59:22 -07:00
Brian Vaughn
2245206c4c Add source location to debug logging info 2019-06-04 08:56:10 -07:00
Brian Vaughn
5963998fbe Display density preference updates :root fontSize
As a result, paddings and sizes (e.g. tab bar heights) will also be impacted now by this preference. More importantly, Profile charts will also use the line height preference, so the 'comfortable' setting will hopefully make profiling data easier to read.
2019-06-04 07:24:14 -07:00
Brian Vaughn
95a99867f7 Decreased contrast of HOC badges in selected props panel 2019-06-03 12:51:04 -07:00
Brian Vaughn
ef139a1811 Batched tweaks and bug fixes:
1. Bugfix: Hide tree grouping/background coloring when inside of collapsed subtree.
2. Bugfix: Don't measure and udpate indentation when Components tab is hidden.
3. Tweak: Lower background color for selected subtree in light theme to increase contrast for text.
4. Tweak: Remove FB-specific displayName check/hack since we will address that by modifying the internal require JS transform.
2019-06-03 12:47:26 -07:00
Brian Vaughn
edfc1bb2b3 Simplified background highlight style now that corner radius has been removed from selected highlight 2019-06-03 10:46:37 -07:00
Brian Vaughn
06b004b5d4 Renamed <Guideline> to <SelectedTreeHighlight> 2019-06-03 09:39:31 -07:00
Brian Vaughn
fbc6e5d68a Removed outdated comment and Eslint rule ignore 2019-06-03 09:33:48 -07:00
Brian Vaughn
6ac558df2d Reset max indentation when entering/exiting the owner tree 2019-06-03 09:32:28 -07:00
Brian Vaughn
a173f4eb85 Add HOC component filter 2019-06-03 08:51:50 -07:00
Brian Vaughn
78cf211286 Only shrink indentation. Don't increase it again. This avoids 'jumping'. 2019-06-03 08:01:48 -07:00
Brian Vaughn
f713265a00 Cap indentation increase at a max 2019-06-02 21:01:24 -07:00
Brian Vaughn
8261a3f453 Removed Tree padding 2019-06-02 20:25:57 -07:00
Brian Vaughn
dc08e80037 Cache list rows by Element ID rather than index
This is important since we are caching element sizes by DOM (in a WeakMap). Toggling (as well as insertion/deletion) might otherwise break this in some cases.
2019-06-02 20:10:30 -07:00
Brian Vaughn
6b6e571c68 Added HOC badge to owners list dropdown 2019-06-02 10:50:07 -07:00
Brian Vaughn
27d4f0b24d Fixed box drawing chars comment 2019-06-02 10:40:10 -07:00
Brian Vaughn
dc945f6b81 Fixed a typo in string truncation util 2019-06-02 10:06:05 -07:00
Brian Vaughn
17b04c321c Cleaned up how we measure children and adjust indentation size 2019-06-02 10:02:22 -07:00
Brian Vaughn
3f0606f3d9 Refactored badges to share code and show +count 2019-06-01 18:48:24 -07:00
Brian Vaughn
6a69a6e991 Added HOC badge to owners stack breadcrumbs 2019-06-01 18:05:59 -07:00
Brian Vaughn
c1989448f4 Disable guide/group highlight in owners tree mode 2019-06-01 17:49:51 -07:00
Brian Vaughn
96dc003a70 Removed debounce+animation from indentation adjustment 2019-06-01 17:48:01 -07:00
Brian Vaughn
b5f8998859 Added debounce and animation for resize 2019-06-01 11:16:18 -07:00
Brian Vaughn
de9fb0a8a2 Tweaked guideline background color style 2019-06-01 09:34:39 -07:00
Brian Vaughn
ab7ae78511 Tweaked a few styles 2019-06-01 09:19:32 -07:00
Brian Vaughn
2845a7883b Whoops I broke CI (updating snapshots) 2019-06-01 08:44:55 -07:00
Brian Vaughn
aa87b125e7 Lots of tweaks
Remove selected guideline in favor of background color for selected subtree.
Add badges in grid format to selected elements prop panel.
Show badges beside owners list.
2019-06-01 08:24:24 -07:00
Brian Vaughn
19d95a1368 Revert "Re-added indent lines"
This reverts commit 33432b037f.
2019-05-31 14:41:20 -07:00
Brian Vaughn
33432b037f Re-added indent lines 2019-05-31 13:34:55 -07:00
Brian Vaughn
5a269e7ced Initial POC for compressing horizontal offset for wide/deep trees 2019-05-31 11:24:34 -07:00
Dan Abramov
2794b92164 Add some support for reordering 2019-05-31 18:00:56 +01:00
Dan Abramov
c3be085910 Remove crawling for updates
It doesn't seem necessary to crawl because mounts only happen in the context of updates.

This fixes updates to not be treated as new mounts.
2019-05-31 17:41:11 +01:00
Dan Abramov
6fd83acb1d Default to showing host nodes for legacy renderer 2019-05-31 15:39:00 +01:00
Dan Abramov
9f44251ebf Remove unnecessary code for host text as we skip it anyway 2019-05-31 14:27:22 +01:00
Brian Vaughn
c0f686eed9 Show indent lines preference 2019-05-30 14:30:17 -07:00
Brian Vaughn
a2a468743f Remove hover guideline in favor of showing guidelines for every nesting level 2019-05-30 14:17:12 -07:00
Brian Vaughn
a957031fe7 Fixed bad Bridge disconnections 2019-05-30 09:27:28 -07:00
Brian Vaughn
8f8ac358c6 Turn off pointer events for guidelines 2019-05-30 08:43:45 -07:00
Brian Vaughn
ec421355bd Added selected and hovered guidelines to Components tree 2019-05-30 08:22:06 -07:00
Brian Vaughn
d5be489d5b Backed out Bridge shutdown refactor as it seems to have introduced bugs 2019-05-29 14:23:10 -07:00
Brian Vaughn
5429f651b4 Tweaks 2019-05-28 13:57:05 -07:00
Sunil Pai
388b03dd12 prettier 2019-05-28 20:24:35 +01:00
Sunil Pai
9e87e654f5 pass tests and flow 2019-05-28 20:21:55 +01:00
Sunil Pai
c7580fcd3f Merge remote-tracking branch 'upstream/master' into act-async 2019-05-28 20:21:38 +01:00
Brian Vaughn
92c2d8366b Updated Chrome installation
1. Removed auto-updates XML (since the feature doens't work for self hosted extensions)
2. Replaced CRX with packed ZIP (since people are having trouble with the CRX, and auto-udpates doesn't work anyway)
2019-05-28 08:52:21 -07:00
Brian Vaughn
fa0139afbf Merged master 2019-05-26 10:47:55 -07:00
Brian Vaughn
af47c39dbb Added and view-source support for Memo components 2019-05-26 10:33:19 -07:00
Brian Vaughn
4422337562 Added another (disabled) test; refactored getChildren slightly 2019-05-26 08:37:05 -07:00
Brian Vaughn
94bebda825 Merged master 2019-05-25 09:10:43 -07:00
Brian Vaughn
bda8a0aa98 Decreased contrast of disabled button icons to look more obviously disabled 2019-05-24 16:00:12 -07:00
Brian Vaughn
c8411019f1 Updated profiler overview 2019-05-24 14:43:56 -07:00
Brian Vaughn
e76cee394d Added section about inspecting element to OVERVIEW 2019-05-24 14:31:05 -07:00
Brian Vaughn
4cc7e748d1 Merge pull request #289 from bvaughn/cache-inspected-element
Cache inspected element data until it is updated
2019-05-24 09:26:31 -07:00
Brian Vaughn
efc2f82da2 Reorganize inspected element state vars slightly 2019-05-24 09:17:20 -07:00
Brian Vaughn
f580d0ece7 Don't (re)serialize inspected elements either unless they have re-rendered since last inspected. 2019-05-24 09:07:15 -07:00
Brian Vaughn
07db37f030 Cache inspected element data until it is updated 2019-05-24 07:37:46 -07:00
Brian Vaughn
408fbee23b Fix potential RTE caused by setting (saved) profiling data while profiling is in progress 2019-05-23 14:49:47 -07:00
Brian Vaughn
395c02567c Handle HTTPS Git clone URLs 2019-05-23 11:55:32 -07:00
Brian Vaughn
6e8c2015fc Tweaked Bridge shutdown sequence slightly 2019-05-23 11:46:28 -07:00
Brian Vaughn
34f6fa4fab Added a sanity test for Bridge shutdown 2019-05-23 11:22:02 -07:00
Brian Vaughn
f47b40fe6c Tweaked event display name logic 2019-05-23 09:30:31 -07:00
Dominic Gannaway
9a67ba2f98 Remove snapshot 2019-05-23 09:17:50 -07:00
Dominic Gannaway
70084e881b Update snapshot tests 2019-05-23 09:17:37 -07:00
Dominic Gannaway
8eb7eddd1f Run prettier 2019-05-23 09:17:37 -07:00
Dominic Gannaway
779fd167ff Adds inspectable event components + props
[Flare] Adds inspectable event components + props
2019-05-23 09:17:37 -07:00
Brian Vaughn
e4aa3c5b33 Update profiling-supported status each time roots change (and added tests) 2019-05-23 09:09:35 -07:00
Brian Vaughn
74d8207e06 Improved visual style of Profiling-disabled button 2019-05-23 08:52:27 -07:00
Brian Vaughn
541dd6c4b6 Moved profiling-supported subscription into ProfilerContext 2019-05-23 08:48:51 -07:00
Brian Vaughn
0608b1a554 Merge pull request #281 from bvaughn/persiste-profiling-data-after-navigation
[WIP] Don't erase profiler data on navigation
2019-05-23 08:38:59 -07:00
Brian Vaughn
44fbf3cd1d Added ProfilerContext tests 2019-05-23 08:36:34 -07:00
Brian Vaughn
5719454377 Persist profiling data after navigation 2019-05-22 20:00:21 -07:00
Brian Vaughn
351d5f662a Add Tab id to Tooltip 2019-05-22 20:00:06 -07:00
Brian Vaughn
f14a2fd05c Use @reach tooltips for TabBar, cleanup supports-profiling subscription 2019-05-22 18:44:43 -07:00
Brian Vaughn
98623dfdb0 Tweak 2019-05-22 16:40:40 -07:00
Dominic Gannaway
d98161874c [Flare] Ensure DOM inspection is Flare compatible 2019-05-22 16:29:54 -07:00
Brian Vaughn
eaaeb439b4 Fixed a missing remove-event-listener in ProfilerStore 2019-05-22 10:52:15 -07:00
Brian Vaughn
b556f7444d Profiler properly handles unmounted roots 2019-05-22 10:19:26 -07:00
Brian Vaughn
b4a3ef9fb2 Merge pull request #279 from bvaughn/profiling-architecture-eager-data-push
Refactor Profiler architecture
2019-05-22 10:00:52 -07:00
Brian Vaughn
962865e5bf Add datetime to the profiling export filename 2019-05-22 09:57:10 -07:00
Brian Vaughn
fbd82385d2 Fixed a state cleanup issue if Profiler data is cleared 2019-05-22 09:04:55 -07:00
Brian Vaughn
d1344768b2 Changed export code to (hopefully) support larger exports 2019-05-22 08:41:57 -07:00
Brian Vaughn
ec44eb1e4c Tweaked did-not-render text color to be slightly dimmer 2019-05-22 08:32:10 -07:00
Brian Vaughn
a03c3b5d14 Bumped Profiler exported data version 2019-05-22 08:22:33 -07:00
Brian Vaughn
d09299bf85 Cleaned up some tests 2019-05-22 08:05:34 -07:00
Brian Vaughn
99b6a44beb Updated event subscriptions and getters to use new ProfilerStore 2019-05-22 07:40:41 -07:00
Brian Vaughn
2d4bb01c01 Moved profiling data to ProfilerContext to fix re-import bug 2019-05-22 07:28:26 -07:00
Brian Vaughn
95bd6c8f63 Added export to web shell and removed 'downloads' API permission 2019-05-22 06:46:42 -07:00
Brian Vaughn
36d51f4eb6 Added root selector UI to Profiler 2019-05-22 06:40:04 -07:00
Brian Vaughn
c6de014a9a Massively overhauled profiling data architecture 2019-05-22 06:05:25 -07:00
Brian Vaughn
7ce9f4859c Renamed Store importedProfilingData -> profilingData 2019-05-20 10:45:16 -07:00
Brian Vaughn
f1561e9e17 Merge pull request #274 from bvaughn/commit-priority-level
Show commit priority levels in Profiler UI (if available)
2019-05-20 09:56:58 -07:00
Brian Vaughn
d440380719 Upgraded to canary with priority level info 2019-05-20 09:54:07 -07:00
Brian Vaughn
53de5b69cc Updated test snapshot 2019-05-20 09:42:37 -07:00
Brian Vaughn
16a81feb72 Moved priority level constants into rendeer interface 2019-05-20 09:39:26 -07:00
Brian Vaughn
9a6a19456f Show commit priority levels in Profiler UI 2019-05-20 09:39:26 -07:00
Brian Vaughn
146fd2ad3d Fixed snapshot diff 2019-05-17 07:54:07 -07:00
Brian Vaughn
629e500fe2 Merge pull request #275 from lucasecdb/fix/undefined-chartnode
Fix undefined chart node when switching commits in profiler
2019-05-17 07:52:07 -07:00
Lucas Cordeiro
1e025edb9a Fix undefined chart node when switching commits in profiler 2019-05-17 09:35:10 -03:00
Brian Vaughn
f10a6b379c Improve scanning Profiler chart for deep renders 2019-05-15 14:20:36 -07:00
Brian Vaughn
6fd2e72b5e Minor nits 2019-05-14 11:01:41 -07:00
Ivan Babak
76e569992b Cleanup profile export/import data types, add export/import test
Strengthened the I/O-boundary type conversion logic.

Fixed type inconsistencies uncovered by removing `any` and
by making explicit type annotations and transformations.

In particular, these were likely malformed when restored from a file:
- `commitDetails`
- `interactions`
- `initialTreeBaseDurations`

The mismatches were Map vs interleaved Array.
2019-05-13 23:59:01 -07:00
Brian Vaughn
1723c5d316 Changed "Unknown" fallback displayName to "Anonymous". Added memo/forwardRef labels to Profiler charts. 2019-05-13 15:26:14 -07:00
Brian Vaughn
6b4c758338 CSS tweaks 2019-05-13 14:51:56 -07:00
Brian Vaughn
e2746ffd0e Merge branch 'enhancement/display-change' of https://github.com/submetu/react-devtools-experimental into submetu-enhancement/display-change 2019-05-13 14:12:27 -07:00
Brian Vaughn
982eb84a13 Merge pull request #271 from tux-tn/master
Replaced adm-zip with node-archiver
2019-05-13 14:10:21 -07:00
Brian Vaughn
d9a0c42652 Bumped Profiler export version (since self durations are now included) 2019-05-13 14:04:53 -07:00
Brian Vaughn
cf99c3ee6c Moved calculation of self duration to the backend/renderer
This enables self duration to be computed accurately despite component filters
2019-05-13 10:13:29 -07:00
Subhan
74706b0c86 updates snapshots 2019-05-13 19:00:11 +02:00
Subhan
ec89ae88b6 Changes display of ForwardRef and Memo components 2019-05-13 18:58:03 +02:00
Sarhan Aissi
ad94f9ef08 Replaced adm-zip with node-archiver 2019-05-13 03:55:05 +01:00
Brian Vaughn
ffef7ffc57 Merge pull request #268 from frankcalise/master
Fixed build chrome not working on Windows due to rm command not existing
2019-05-12 07:43:19 -07:00
Brian Vaughn
faea8ed6a9 Delete package-lock.json 2019-05-12 07:43:07 -07:00
Frank Calise
285568825b Fixed build chrome not working on Windows due to rm command not existing 2019-05-12 10:12:17 -04:00
Brian Vaughn
b74f3f507a Added basic tests for InspectedElementContext 2019-05-10 09:13:54 -07:00
Brian Vaughn
61ab40c15c Test utils actSuspense -> actAsync 2019-05-10 08:27:14 -07:00
Brian Vaughn
8536995b11 Merge pull request #264 from bvaughn/filter-owners-list
Fetch owners list from renderer (using suspense)
2019-05-10 08:10:24 -07:00
Brian Vaughn
ac0022bf4a Added more tree context tests 2019-05-10 08:07:27 -07:00
Sunil Pai
7aaef6f41f reverting the rename 2019-05-10 12:18:40 +01:00
Sunil Pai
6243d19b9c pretty, witty, fine 2019-05-10 12:16:43 +01:00
Sunil Pai
ae3b98f5ad rewrite test act helpers based on react/#15591
This simplifies your test helpers to loop until all timers are flushed (including the ones that get queued after updates), and works in concurrent mode. I also renamed actSuspense to actAsync to be clearer.
2019-05-10 12:13:14 +01:00
Brian Vaughn
7160f6f584 Fixed owners stack direction and added current element to stack 2019-05-09 18:11:17 -07:00
Brian Vaughn
427f0f63c1 Added TreeContext tests 2019-05-09 15:52:50 -07:00
Brian Vaughn
5daf9b626f Fixed test describe name 2019-05-09 14:31:48 -07:00
Brian Vaughn
b6c135c165 Added Jest tests for OwnersListContext 2019-05-09 14:21:22 -07:00
Brian Vaughn
564a223368 Fetch owners list from renderer (using suspense)
Owners in the list may have been filtered out of the Store, but in the owners list view- it's important to still show them. The frontend cannot do this on its own, so this list needs to come from the renderer interface.
2019-05-09 11:47:22 -07:00
Brian Vaughn
17516b76ae Dim owners that have been filtered from the tree in rendered-by list 2019-05-08 18:23:54 -07:00
Brian Vaughn
0722a5a024 Tweaked REAMDE 2019-05-08 17:58:31 -07:00
Brian Vaughn
ee099124e2 Fixed a Profiler memoization bug and improved test coverage 2019-05-08 15:41:57 -07:00
Brian Vaughn
d42f86bb50 Updated Profiling chart tests to cover components with duration=0 2019-05-08 14:35:43 -07:00
Brian Vaughn
df10afba51 Merge pull request #262 from submetu/enhancement/label-improvement
Profiler: Improve labels for times that round to 0.0ms
2019-05-08 14:26:16 -07:00
Brian Vaughn
4f1d347c04 Custom filters are applied by default after extension reload 2019-05-08 14:22:06 -07:00
Subhan
34a38dc4f0 updates snapshots and removes extra formatting from formatTime 2019-05-08 23:33:26 +03:00
Subhan
d3522f1f66 Uses FormDuration and FormTime to format times that are 0 into something more readable 2019-05-08 23:18:43 +03:00
Brian Vaughn
98260f8614 Added installation instructions to README 2019-05-08 12:53:22 -07:00
Brian Vaughn
703706b40f Add toggle-suspense button to all elements
This button is disabled if the renderer returns canToggleSuspense=false.
2019-05-08 10:50:32 -07:00
Brian Vaughn
dbe68f7a67 Updated lint ignore for new dev shell dist folder 2019-05-08 08:52:48 -07:00
Subhan
60511aadc0 Profiler: Improve labels for times that round to 0.0ms 2019-05-08 10:11:52 +03:00
Brian Vaughn
a54581c2dd Fixed invalid DOM nesting warning 2019-05-07 15:25:17 -07:00
Brian Vaughn
44e90e6ef4 Upgrade @reach UI and remove tooltip fork 2019-05-07 15:22:57 -07:00
Brian Vaughn
97b7fdd2d9 Fixed a deprecated prop warning from react-window 2019-05-07 14:47:37 -07:00
Brian Vaughn
278661715c Show import error dialog if profiling data import fails 2019-05-07 14:38:11 -07:00
Brian Vaughn
acdc9bae67 Added export+import profiling data test coverage
Also fixed an incomplete import feature as well as a regression in export that had gone unnoticed due to previous lack of test coverage.
2019-05-07 13:08:46 -07:00
Brian Vaughn
90701815b6 Merge pull request #258 from bvaughn/profiler-test-experiments
Added profiler tests
2019-05-06 14:00:45 -07:00
Brian Vaughn
7ead699714 Prettier 2019-05-06 13:58:49 -07:00
Brian Vaughn
6ab8972345 Update to React canary release for interaction tracing bugfix 2019-05-06 13:52:27 -07:00
Brian Vaughn
c2bf71f406 Added commit tree builder test 2019-05-06 13:41:36 -07:00
Brian Vaughn
b25d996fc4 Added profiling chart data tests 2019-05-06 13:37:06 -07:00
Brian Vaughn
d86bc1020e Hardened tests to ensure expectations are flushed 2019-05-06 13:04:14 -07:00
Brian Vaughn
705cd9b109 Added Flow types to profiling test 2019-05-06 09:44:01 -07:00
Brian Vaughn
c29483122c Removed outdated TODO comment 2019-05-05 09:56:54 -07:00
Brian Vaughn
269969b645 Updated snapshot data after ReactDOM batch fix 2019-05-05 09:52:27 -07:00
Brian Vaughn
1c49a7ef59 Added remaining profiling tests. One currently fails because of a bug with act() and interaction tracing 2019-05-04 14:22:50 -07:00
Brian Vaughn
da1e5776b1 Added a second Profiling test (for CommitDetails) and fixed some module reset prolems 2019-05-04 13:11:56 -07:00
Brian Vaughn
dd96b3314c Cleaned up tests a bit. Profiling test uses mock timers now. 2019-05-04 09:36:13 -07:00
Brian Vaughn
f7c8e3a05c Experimenting with profiler tests 2019-05-03 15:01:26 -07:00
Brian Vaughn
a8ed95445c Store profiler snapshot data by root (and clear on root unmount) 2019-05-03 14:59:20 -07:00
Brian Vaughn
a552b7b5f7 Only clear Profiling snapshot on root-unmount 2019-05-03 10:12:45 -07:00
Brian Vaughn
73cf0fa32b Merge branch 'master' into sompylasar-232-clear-profiling-data-for-unmounted-root 2019-05-03 10:01:43 -07:00
Brian Vaughn
542409954a Merge pull request #257 from bvaughn/right-align-flame-graph
Right-align flame graph children
2019-05-03 10:01:23 -07:00
Brian Vaughn
8585ee37db Renamed assertOneMap -> assertEmptyMap 2019-05-03 09:30:48 -07:00
Brian Vaughn
8850a9a64a Merge branch '232-clear-profiling-data-for-unmounted-root' of https://github.com/sompylasar/react-devtools-experimental into sompylasar-232-clear-profiling-data-for-unmounted-root 2019-05-03 09:24:58 -07:00
Brian Vaughn
e71bda5257 Right-align flame graph children 2019-05-03 09:21:26 -07:00
Brian Vaughn
435e22ad1b Fixed deploy script 2019-05-03 08:55:31 -07:00
Brian Vaughn
07281993d1 Merge pull request #242 from sompylasar/improve-flow-coverage-any
Improve Flow coverage by reducing typecasts through `any`
2019-05-03 08:00:47 -07:00
Brian Vaughn
868cf67aa4 Removed findCurrentFiberUsingSlowPath() in favor of findCurrentFiberUsingSlowPathById() 2019-05-03 07:56:24 -07:00
Brian Vaughn
7f4482e438 Removed optional_chaining from Flow config 2019-05-03 07:48:30 -07:00
Brian Vaughn
40ed0ca839 Merge branch '165-add-flow-types-for-fiber' of https://github.com/sompylasar/react-devtools-experimental into sompylasar-165-add-flow-types-for-fiber 2019-05-03 07:48:21 -07:00
Brian Vaughn
4bf3ac1910 Fixed broken path-selection after filter changes 2019-05-02 15:21:29 -07:00
Brian Vaughn
d7447a8458 Fixed bug in Store.getIndexOfElementID() that caused roots with multiple top-level children to return an incorrect item index 2019-05-02 15:12:57 -07:00
Brian Vaughn
4e04907d13 Added badge for enabled filter count 2019-05-02 10:53:40 -07:00
Brian Vaughn
ef596be1ef Merge pull request #207 from sompylasar/131-highlight-all-children
Support highlighting of all DOM elements of Fragments, not just first
2019-05-02 08:31:22 -07:00
Brian Vaughn
1473e9efc8 Merge pull request #245 from bvaughn/custom-filtering
Add configurable component filters
2019-05-01 17:52:27 -07:00
Brian Vaughn
83b521c7b4 Updated Flamechart to support multiple nodes at root 2019-05-01 17:44:38 -07:00
Brian Vaughn
4a4786ac2f Misc cleanup 2019-05-01 14:18:20 -07:00
Brian Vaughn
e6da4b9058 Renamed FilterType -> ComponentFilterType 2019-05-01 14:01:03 -07:00
Brian Vaughn
e45deb5471 Removed $FlowFixMe comments 2019-05-01 13:59:54 -07:00
Brian Vaughn
540207901d Added some component filtering tests 2019-05-01 13:31:55 -07:00
Brian Vaughn
8429220164 Added filter UI (but with a lot of $FlowFixMe comments) 2019-05-01 10:45:18 -07:00
Brian Vaughn
0b4bfbc98f Add support for hide-by-name and hide-by-path component filter regexps 2019-05-01 10:45:18 -07:00
Brian Vaughn
a2ba90bf96 Fixed a path selection bug when filter pereferences are updated 2019-05-01 10:45:18 -07:00
Brian Vaughn
c4c51c0821 Prevent filter preference changes while profiling is active 2019-05-01 10:45:18 -07:00
Brian Vaughn
eb9705abc8 Removed FilterList UI for now (collapsed into Settings component) 2019-05-01 10:45:18 -07:00
Brian Vaughn
a241780dc2 Filter changes are applied to the renderer without reloading 2019-05-01 10:45:18 -07:00
Brian Vaughn
27a1820039 Refactored filter preferences a bit more to be stored in the Store 2019-05-01 10:45:18 -07:00
Brian Vaughn
ee1b38e4db Added filter preference types and plugged into renderer partly. Lots of work to do still. 2019-05-01 10:45:18 -07:00
Brian Vaughn
9db209ee64 Initial pass at adding filter-by-type Flow types and support to renderer 2019-05-01 10:45:18 -07:00
Brian Vaughn
17c5feb66a Reorganized types shared between backend and frontend slightly. 2019-05-01 10:45:18 -07:00
Brian Vaughn
18b34b4926 Rearranged Settings UI in prep for custom filter controls 2019-05-01 10:45:18 -07:00
Brian Vaughn
a9aa9f2106 Merge pull request #251 from gaearon/devserver
Use WebpackDevServer for local testing
2019-05-01 09:29:43 -07:00
Dan Abramov
b9ae9393b9 Use WebpackDevServer for local testing 2019-05-01 17:19:26 +01:00
Ivan Babak
cd89c0d75f Clear profiling data for root when the root is unmounted
Fixes https://github.com/bvaughn/react-devtools-experimental/issues/232
2019-05-01 01:46:47 -07:00
Ivan Babak
c6c71ef8f9 Fix profiling screenshots data structure to map rootID to commitIndex
Propagate `rootID` throughout the code for `captureScreenshot`.

Rename private profiling maps of `store` to make relations more clear.

Fix missing cleanup for screenshots data in `set importedProfilingData` of `store`.
2019-05-01 01:07:36 -07:00
Ivan Babak
d1f6e762e4 Improve Flow coverage by reducing typecasts through any
There are many unnecessary typecasts through `any` which
break the Flow of types across the program.

It's more bulletproof to avoid lying to ourselves about types.

Also fixed sketchy null check where zero ID would be skipped:
```diff
-  } else if (selectedElementID) {
+  } else if (selectedElementID !== null) {
```
2019-05-01 00:31:13 -07:00
Brian Vaughn
abcb613223 Minor Bridge code tweaks:
1. Renamed a variable
2. Coerced undefined to null
3. Added a couple of console.warn() for unexpected paths
2019-04-30 09:23:11 -07:00
Brian Vaughn
5204ae87bc Merge pull request #229 from sompylasar/217-workaround-disconnected-port-error
Fix for 'Attempting to use a disconnected port object'
2019-04-30 09:15:52 -07:00
Brian Vaughn
b24216a7b1 Merge pull request #234 from gaearon/nested-suspense-test
Add test coverage for nested Suspense
2019-04-30 08:51:58 -07:00
Brian Vaughn
9e1b1e8c91 Merge pull request #233 from gaearon/preset-env
Start using @babel/preset-env
2019-04-30 08:50:17 -07:00
Brian Vaughn
da951ec9bb Merge pull request #243 from sompylasar/rename-profiler-types-to-frontend-backend-to-disambiguate
Rename Profiler types to disambiguate which is Frontend and Backend
2019-04-30 08:47:05 -07:00
Brian Vaughn
44205f16d9 Merge pull request #247 from sompylasar/fix-flow-on-circleci
Fix Flow failure on CircleCI due to the number of workers
2019-04-30 08:32:37 -07:00
Ivan Babak
bfbde71657 Fix Flow failure on CircleCI due to the number of workers
https://github.com/flowtype/flow-bin/issues/138#issuecomment-448416874
https://github.com/flowtype/flow-bin/issues/138#issuecomment-450367472

> This will stop flow from trying to consume too many virtual CPUs (which CircleCI doesn't actually provide), letting it run to completion without first running out of memory and killing its sub processes.

The log output in CircleCI was:
https://circleci.com/gh/bvaughn/react-devtools-experimental/201
```
#!/bin/bash -eo pipefail
yarn flow
yarn run v1.10.1
$ /home/circleci/repo/node_modules/.bin/flow
Launching Flow server for /home/circleci/repo
Spawned flow server (pid=259)
Logs will go to /tmp/flow/zShomezScirclecizSrepo.log
Monitor logs will go to /tmp/flow/zShomezScirclecizSrepo.monitor_log
Launching Flow server for /home/circleci/repo
Spawned flow server (pid=361)
Logs will go to /tmp/flow/zShomezScirclecizSrepo.log
Monitor logs will go to /tmp/flow/zShomezScirclecizSrepo.monitor_log
Launching Flow server for /home/circleci/repo
Spawned flow server (pid=464)
Logs will go to /tmp/flow/zShomezScirclecizSrepo.log
Monitor logs will go to /tmp/flow/zShomezScirclecizSrepo.monitor_log
Launching Flow server for /home/circleci/repo
Spawned flow server (pid=567)
Logs will go to /tmp/flow/zShomezScirclecizSrepo.log
Monitor logs will go to /tmp/flow/zShomezScirclecizSrepo.monitor_log
Lost connection to the flow server (0 retries remaining): -Out of retries, exiting!
error Command failed with exit code 7.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Exited with code 1
```
2019-04-29 21:56:53 -07:00
Ivan Babak
d35cf80921 Remove Fiber type properties we don't use in DevTools 2019-04-28 12:57:28 -07:00
Dan Abramov
d351b46aee Merge pull request #238 from sompylasar/fix-typo-recursivelyinitializetree
Fix typo `recursivelyIniitliazeTree` -> `recursivelyInitializeTree`
2019-04-28 13:38:49 +01:00
Dan Abramov
7c04883f8d Merge pull request #239 from sompylasar/remove-agent-addbridge
Remove Agent addBridge: there can only be one bridge, add in constructor
2019-04-28 13:38:34 +01:00
Ivan Babak
1b5f043e01 Fix for 'Attempting to use a disconnected port object'
Fixes https://github.com/bvaughn/react-devtools-experimental/issues/217

The error reproduces with any two React websites, e.g. `https://reactjs.org` and `https://nextjs.org`, by keeping the DevTools Components tab open and switching between these websites in the same browser tab.

There are several issues with the code that contribute to this:
1. `Bridge` leaves behind a dangling timer that fires `_flush` after the bridge has been abandoned ("shutdown").
2. `bridge.send('shutdown')` is asynchronous, so the event handlers do not get unsubscribed in time.
3. `port.onDisconnect` does not trigger on in-tab navigation like new URL or back/forward navigation.
4. State management design of the code that uses shared variables and callbacks makes it hard to handle race conditions originating from the browser.

This commit cleans up some of the lacking symmetry when using `addListener`/`removeListener`, but the code in `shells/browser/shared/src/main.js` is hard to reason about with regards to race conditions, and there are many possible race conditions originating from the browser, so maybe there could be a better design paradigm (like a formal state machine) to manage the state changes in response to sequences of events than plain old event listeners, callbacks, and shared variables.

Unrelated, but clicking Chrome Back/Forward/Back/Forward very fast makes the browser and the DevTools and the DevTools of DevTools stall and become unresponsive for some time, then recovers but the Back/Forward/Stop/Refresh button and favicon loading indicator may remain broken. Looks like a Chrome bug, some kind of a temporary deadlock in handling the browser history.
2019-04-28 04:45:57 -07:00
Ivan Babak
d3e5fcd81c Rename Profiler types to disambiguate which is Frontend and Backend
Flow IDE shows the original type, not the file-scoped alias,
so it's confusing to see incompatible variables that have types
with the same name.

This started from `src/devtools/ProfilingCache.js` where
`ProfilingSummary` was incompatible, but I decided to make a bigger
change for consistency and to avoid similar mistakes in the future.
2019-04-28 04:40:39 -07:00
Ivan Babak
9f06bc345f Add Flow types for Fiber
Fixes https://github.com/bvaughn/react-devtools-experimental/issues/165
2019-04-28 04:18:27 -07:00
Ivan Babak
0b817777b4 Remove Agent addBridge: there can only be one bridge, add in constructor
Let's make impossible states truly impossible, and fix Flow types, too.

All three usages of Agent called addBridge right after constructing it.
Agent has one field `_bridge` which is force-typed as not-null despite
there's a temporary zone between the constructor end and addBridge start
where `_bridge` is null.
2019-04-28 04:03:28 -07:00
Ivan Babak
19bfba7943 Fix typo recursivelyIniitliazeTree -> recursivelyInitializeTree 2019-04-28 03:52:33 -07:00
Dan Abramov
d81d74b236 Add test coverage for nested Suspense 2019-04-26 20:04:28 +01:00
Dan Abramov
e5ed266873 Start using @babel/preset-env 2019-04-26 19:37:23 +01:00
Dan Abramov
2118b1fe1b Merge pull request #230 from gaearon/assert-maps
Assert empty maps when there are no roots
2019-04-26 18:15:04 +01:00
Dan Abramov
b6a55989f5 Assert empty maps when there are no roots 2019-04-26 17:47:00 +01:00
Brian Vaughn
c28acc5d47 Changed owners back button label to say 'Up to <...>' 2019-04-26 09:38:25 -07:00
Ivan Babak
281616f462 Support highlighting of all DOM elements of Fragments, not just first
Fixes https://github.com/bvaughn/react-devtools-experimental/issues/131

Uses the new function `findAllCurrentHostFibers`.

Removes dependency on React's `renderer.findHostInstanceByFiber` function
which used to highlight only the first DOM element of a Fragment.

Reworked `src/backend/views/Overlay` to support highlighting
more than one element rectangle annotated with one tooltip.
Fixed minor issues with the tooltip position calculation.
2019-04-26 01:22:49 -07:00
Brian Vaughn
707b44834f Merge pull request #213 from wldcordeiro/fix-firefox-perms
fix: correct permissions for Firefox
2019-04-25 19:11:39 -07:00
Brian Vaughn
043b73e0a8 Merge pull request #223 from bvaughn/owners-list-intermediate-components
Owners list view should drill through intermediate components
2019-04-25 15:10:08 -07:00
Brian Vaughn
09029acf00 Refactored owners list to use cached metadata (and added more tests) 2019-04-25 15:06:24 -07:00
Brian Vaughn
15eacae02c Moved owners list calculations into the store and added tests
This is being done to fix a drill-through bug, although the initial fix is perhaps not the most performant one. At least we have test coverage now and a temporary fix.
2019-04-25 15:06:24 -07:00
Brian Vaughn
b6d617ac7f Added 'back to owner' button when owners stack is collapsed 2019-04-25 15:05:39 -07:00
Brian Vaughn
e88819a22e Reverse direction of menu items within drop-down owners list 2019-04-25 14:10:51 -07:00
Dan Abramov
a0b1fb37fb Merge pull request #227 from gaearon/string-table
Transfer strings in a string table
2019-04-25 17:54:11 +01:00
Dan Abramov
1bea469db0 Remove unneeded variable 2019-04-25 17:46:48 +01:00
Dan Abramov
af2d1374c4 Let -> const 2019-04-25 17:39:13 +01:00
Dan Abramov
3920ebd0a1 Clarify encoding in overview 2019-04-25 17:32:46 +01:00
Dan Abramov
c8f8943c9a Transfer strings in a string table 2019-04-25 17:11:24 +01:00
Dan Abramov
c1363b7e17 Merge pull request #226 from gaearon/mutate-children
Improve performance by mutating the children array
2019-04-25 15:27:36 +01:00
Dan Abramov
2e423c21b0 Merge pull request #221 from gaearon/heuristic
Use a heuristic for locating roots
2019-04-25 15:22:34 +01:00
Dan Abramov
e1383c666d Allow to set tracked path multiple times
Fixes #225. This happens when you close and reopen DevTools while on the same page.
2019-04-25 14:57:39 +01:00
Dan Abramov
2993b168e5 Mutate the children array 2019-04-25 14:47:05 +01:00
Dan Abramov
d5319566a1 Fix broken start:prod command 2019-04-25 14:21:58 +01:00
Dan Abramov
80597a2377 Use a heuristic for locating roots 2019-04-24 23:02:41 +01:00
Dan Abramov
942f67c936 Merge pull request #220 from gaearon/removed-ids
Select parent node if selection is removed
2019-04-24 19:25:05 +01:00
Brian Vaughn
7bae48f00c Fixed minor CSS overflow issue 2019-04-24 09:07:53 -07:00
Brian Vaughn
c855a862c3 Merge pull request #218 from gaearon/bump-react
Bump React versions
2019-04-24 08:45:16 -07:00
Dan Abramov
949384f4ca Select parent node if selection is removed 2019-04-24 16:29:23 +01:00
Dan Abramov
52deada495 Bump React versions 2019-04-24 15:57:43 +01:00
Dan Abramov
54aecf487e Merge pull request #215 from bvaughn/persist-selection
Try to restore selection between reloads
2019-04-24 15:50:29 +01:00
Dan Abramov
f123763fe1 Read index off the Fiber 2019-04-24 15:05:33 +01:00
Dan Abramov
5d2d4213ec Delete stale paths 2019-04-24 15:05:21 +01:00
Dan Abramov
e050529c7d Read renderer ID from operations 2019-04-24 15:00:46 +01:00
Dan Abramov
26162988aa Fix tests 2019-04-24 14:37:46 +01:00
Dan Abramov
7eb7c5a350 Match Fibers to saved selection as they mount
This implements matching Fibers against the tracked selection path.

The algorithm is optimized to do as little checks as possible:

* When not trying to restore selection, we don't do anything
* When restoring selection, we only check .return pointers of new mounts
* Only when .return pointers match our current deepest match, we compare the frames
2019-04-24 14:37:46 +01:00
Dan Abramov
3bb837b683 Implement getPathForElement to serialize the selected path
Note this doesn't restore the selection yet.
2019-04-24 14:37:46 +01:00
Dan Abramov
b1a7007cc5 Keep track of root insertion order in the renderer
Normally, Fibers have key or index which we'll use to match things up between reloads. However, roots don't have such a concept. We'll use their insertion order as an approximation. If it's consistent, we'll be able to restore the selection.
2019-04-24 14:37:46 +01:00
Dan Abramov
d8abecdcf9 Persist and restore selection in agent
This implements the infrastructure for saving and restoring renderer-specific selection state in the session storage.

Note this doesn't actually implement the calculation and tracking of paths in the renderer. It only simulates that the renderer can do it. The actual implementation will come in a later commit.
2019-04-24 14:37:46 +01:00
Brian Vaughn
085d00e877 Merge pull request #196 from bvaughn/selected-element-suspense
Convert inspected element (right panel) to use Suspense
2019-04-23 18:33:05 -07:00
Brian Vaughn
7262a30cf3 Reverted optimization to avoid re-sending inspected fiber unless it committed 2019-04-23 18:04:25 -07:00
Brian Vaughn
0aa7d2f800 Reverted optimization to avoid re-sending inspected fiber unless it committed 2019-04-23 14:03:58 -07:00
Brian Vaughn
1e5c0b7856 Re-added the selection message 2019-04-23 13:43:38 -07:00
Brian Vaughn
4dcb34ea32 Fixed Flow error 2019-04-23 11:32:07 -07:00
Brian Vaughn
53c7338420 Updated flow-bin to attempt to fix the error 2019-04-23 09:00:25 -07:00
Brian Vaughn
d85f566d66 Merged master (tooltip changes) 2019-04-23 08:49:40 -07:00
Brian Vaughn
8b33dd673d Added @reach/tooltip 2019-04-23 08:41:52 -07:00
Brian Vaughn
ec7536704d Locked down canary versions 2019-04-22 19:32:16 -07:00
Brian Vaughn
7f1531044b Differentiate between no-change and no-element-found when inspecting element 2019-04-22 15:37:55 -07:00
Brian Vaughn
00872e2e51 Fixed suspense fallback issue by moving inspection message side effect before suspending render 2019-04-22 15:25:55 -07:00
Brian Vaughn
64bb2d31f9 Fixed bug with cache invalidation 2019-04-22 15:18:32 -07:00
Brian Vaughn
64bc49d523 Run first setState with explicit priority in case of non-React event handlers 2019-04-22 15:11:04 -07:00
Wellington Cordeiro
2d8c28733d fix: correct permissions for Firefox
remove the `background` permissions as it's not used by Firefox, but `activeTab` is and we needed
it.

fix #136
2019-04-22 15:12:33 -06:00
Brian Vaughn
e31ae91023 Removed duplicate scheduler module 2019-04-22 13:10:47 -07:00
Brian Vaughn
ba640df982 Merge branch 'master' into selected-element-suspense 2019-04-22 10:47:34 -07:00
Brian Vaughn
433934f55e Refactored TreeContext to use less memoization (based on feedback from Sebastian) 2019-04-22 10:39:21 -07:00
Brian Vaughn
d53ae2ea8a Refactored TreeContext to use less memoization (based on feedback from Sebastian) 2019-04-22 10:19:59 -07:00
Brian Vaughn
70be637d48 Don't schedule an update with React unless the curent element was invalidated 2019-04-22 09:37:55 -07:00
Brian Vaughn
5970bf4b40 Changed polling approach. Fixed remove event typo. 2019-04-22 09:37:55 -07:00
Brian Vaughn
3de18de25e Tried to implement two setState pattern, but it does not feel right 2019-04-22 09:37:55 -07:00
Brian Vaughn
957c389566 Adding polling and initial stab at not serializing duplicate inspected Element props 2019-04-22 09:37:34 -07:00
Brian Vaughn
c6b19cc141 Refactored insepected element cache to use the context API 2019-04-22 09:37:34 -07:00
Brian Vaughn
09b023a6e6 Naive suspense implementation for selected element panel
This commit leaves a few major things uunresolved:
* We aren't yet polling for updates
* We aren't yet using the two setState pattern
* The resource cache will grow unbounded over time because we aren't yet clearing items from it
* The renderer interface is not smart enough to avoid resending unchanged data between requests
2019-04-22 09:37:34 -07:00
Brian Vaughn
76b29ad0a9 Merge pull request #201 from gaearon/scroll-fix
Fix scrolling to selected row in collapsed mode
2019-04-22 09:37:15 -07:00
Brian Vaughn
52652f3456 Toggle method no longer emits 'mutated' event unless it mutated the store 2019-04-21 12:20:23 -07:00
Brian Vaughn
129466ed91 Yarn deploy sets production NODE_ENV 2019-04-21 09:05:55 -07:00
Brian Vaughn
a01fc44a78 Merge pull request #205 from bvaughn/@reach/tooltip
[BLOCKED] Use new @reach/tooltip
2019-04-21 09:01:23 -07:00
Brian Vaughn
91f74a5134 Fixed focus styles for OwnersStack dropdown toggle button 2019-04-21 08:59:24 -07:00
Brian Vaughn
09b995ab1c Tidied up CSS variables 2019-04-21 08:38:58 -07:00
Brian Vaughn
66df03d179 Renamed CSS var color-text-color to color-text 2019-04-21 08:29:51 -07:00
Brian Vaughn
8220df734c Tweaked hover and focus colors. Temporarily disabled Tooltip. 2019-04-21 08:23:20 -07:00
Brian Vaughn
a129089891 Tweaking focus/active colors and only showing focus rect on tab 2019-04-20 15:44:24 -07:00
Brian Vaughn
403bf49a78 Use new @reach/tooltip 2019-04-20 14:29:03 -07:00
Brian Vaughn
4218dcbf99 Merge pull request #203 from gaearon/push-ops
Push operations directly to the array
2019-04-20 14:27:53 -07:00
Brian Vaughn
740993baa9 Merge branch 'master' into push-ops 2019-04-20 14:26:46 -07:00
Brian Vaughn
72156c744f Merge pull request #204 from gaearon/no-weakset
Replace WeakSet with return pointer check
2019-04-20 14:23:59 -07:00
Brian Vaughn
94d9f61a7d Merge pull request #206 from gaearon/leading
Ignore leading edge of find-by-DOM throttle
2019-04-20 14:22:49 -07:00
Dan Abramov
006e03c38e Ignore leading edge of find-by-DOM throttle 2019-04-20 22:17:12 +01:00
Dan Abramov
c0d7023a88 Replace WeakSet with return pointer check 2019-04-20 21:42:30 +01:00
Dan Abramov
02a3a22753 Push operations directly to the array 2019-04-20 21:05:52 +01:00
Brian Vaughn
4b9082eea1 Changed style and position of search-for-element button to more closely matchin Chrome ( based on user testing) 2019-04-20 10:44:03 -07:00
Dan Abramov
4ffdffb598 Fix scrolling to selected row in collapsed mode 2019-04-20 16:20:03 +01:00
Brian Vaughn
3697ed2bba Merge pull request #199 from gaearon/another-check
Filter out dehydrated Suspense nodes
2019-04-20 08:00:14 -07:00
Brian Vaughn
da2ed30471 Merge pull request #200 from gaearon/clear-stuff
Clear DOM overlay on shutdown
2019-04-20 07:57:11 -07:00
Dan Abramov
d05106e364 Clear DOM overlay on shutdown 2019-04-20 14:34:13 +01:00
Dan Abramov
a186dc2e8d Filter out dehydrated Suspense nodes 2019-04-20 13:57:33 +01:00
Brian Vaughn
d7e8fccd1a Fixed an OVERVIEW typo 2019-04-19 07:54:30 -07:00
Brian Vaughn
5b0b9c9fbc Merge pull request #193 from gaearon/no-reorder
Don't reorder a single child
2019-04-19 07:51:51 -07:00
Dan
9a395c2f2c No need to reorder empty children either 2019-04-19 13:21:09 +01:00
Dan
fb8ad3486e Don't reorder a single child 2019-04-19 13:19:58 +01:00
Dan Abramov
2adbfd9607 Merge pull request #186 from gaearon/more-suspensey-stuff
Fix more Suspense issues
2019-04-19 13:18:50 +01:00
Dan
efb5855c8c Nits 2019-04-19 13:17:17 +01:00
Dan
3e657a6031 Prettier 2019-04-19 13:09:25 +01:00
Dan Abramov
37dd1ec8f8 Merge branch 'master' into more-suspensey-stuff 2019-04-19 13:09:01 +01:00
Brian Vaughn
f286c0d901 Increased contrast for selected+inactive background color 2019-04-18 18:19:10 -07:00
Brian Vaughn
c6a27d1fea Merge branch 'master' of github.com:bvaughn/react-devtools-experimental 2019-04-18 18:13:43 -07:00
Brian Vaughn
c0b414d581 Node scripts should fail if not NODE_ENV specified 2019-04-18 18:13:34 -07:00
Brian Vaughn
131e2e52db Merge pull request #188 from gaearon/humble-search
Don't select search result unless user does something
2019-04-18 18:04:28 -07:00
Brian Vaughn
60b614f527 Renamed TREE_OPERATION_RESET_CHILDREN -> TREE_OPERATION_REORDER_CHILDREN 2019-04-18 17:59:53 -07:00
Brian Vaughn
24736e4ff5 Hardened reorder child invariants 2019-04-18 17:58:48 -07:00
Dan Abramov
3d09b4aaa5 Don't select search result unless user does something 2019-04-19 01:54:39 +01:00
Brian Vaughn
21afd6ea20 Merge pull request #184 from bvaughn/harden
Harden assertions
2019-04-18 17:50:17 -07:00
Dan Abramov
b0c0a11f1b Revert accidental change 2019-04-19 01:41:00 +01:00
Dan Abramov
72e67b343f Add Concurrent Mode test 2019-04-19 01:18:25 +01:00
Dan Abramov
534dfb0ca2 Optimize: don't recreate ID arrays all the time 2019-04-19 01:13:25 +01:00
Dan Abramov
8830ba890c Fix more Suspense traversal bugs 2019-04-19 01:09:57 +01:00
Dan Abramov
346b628b43 Add failing tests for Suspense with same type 2019-04-19 00:36:55 +01:00
Dan Abramov
d44bf272ad Refactor: materialize typed array in one place 2019-04-19 00:32:29 +01:00
Dan Abramov
ccecde76d1 Harden assertions 2019-04-19 00:29:49 +01:00
Brian Vaughn
3dfbf8ad6b Added a new invariant to the store (bridge operations handler) 2019-04-18 15:40:50 -07:00
Brian Vaughn
7930bad8c6 Deploy production extension builds 2019-04-18 14:45:24 -07:00
Brian Vaughn
e2aedb2ea7 Merge pull request #181 from gaearon/consoleerror
Fail tests on errors in renderer
2019-04-18 10:08:44 -07:00
Dan Abramov
d0b5e3a7cb Update setupTests.js 2019-04-18 18:06:34 +01:00
Brian Vaughn
d6e829d7a5 Fixed bug in reset-children to properly calculate new root weight 2019-04-18 09:54:26 -07:00
Brian Vaughn
89f7a0c048 Merge pull request #182 from bvaughn/suspense-toggle
Fixed a Suspense toggling bug that incorrectly impacted tree weight
2019-04-18 09:45:22 -07:00
Brian Vaughn
358e63ac3d Fixed a Suspense toggling bug that incorrectly impacted tree weight 2019-04-18 09:38:41 -07:00
Dan Abramov
8c5794eab3 Fail tests on errors in renderer 2019-04-18 17:03:04 +01:00
Brian Vaughn
b45e743f52 Merge pull request #180 from gaearon/suspense-more-fixes
Fix unmounting in Concurrent Mode
2019-04-18 08:52:30 -07:00
Dan Abramov
6a13ffd231 Traverse the previous current tree when switching from primary to fallback 2019-04-18 16:22:50 +01:00
Dan Abramov
24309fde06 Add failing Concurrent Mode stress tests 2019-04-18 16:22:50 +01:00
Dan Abramov
0f44e9fb98 Move sync stress tests in their own file 2019-04-18 16:22:50 +01:00
Brian Vaughn
456e937b83 Merge pull request #178 from gaearon/removal-integrity
Assert removal happens in the right order
2019-04-18 08:16:22 -07:00
Dan Abramov
d02d93712e Assert removal happens in the right order 2019-04-18 16:02:08 +01:00
Brian Vaughn
08279fb342 Merge pull request #174 from robertknight/mousedown-tab-select
Select tab when the mouse is pressed
2019-04-18 08:00:01 -07:00
Brian Vaughn
d995f19339 Merge pull request #175 from lucasecdb/assign-timeout
Assign timeoutID to avoid multiple requests
2019-04-18 07:56:32 -07:00
Lucas Cordeiro
6df050e726 Assign timeoutID to avoid multiple requests 2019-04-18 06:46:06 -03:00
Robert Knight
c2865dbab9 Select tab when the mouse is pressed
Selecting the tab when the mouse is pressed rather than only when it is
released makes tab switching feel faster and also matches how the Chrome dev
tools behave.

The previous tab selection handler which listens for the radio button's
selection has been kept for the benefit of interaction methods which
don't trigger the mousedown handler.
2019-04-18 08:16:52 +01:00
Brian Vaughn
29811cd24e Added legacy (v15) tests 2019-04-17 15:30:20 -07:00
Brian Vaughn
7ab93402a8 Initial support for v15+ via new legaacy renderer 2019-04-17 14:36:15 -07:00
Brian Vaughn
0d932d770b Merge pull request #168 from bvaughn/collapse-nodes-by-default
Configurable tree default collapsed/expanded behavior
2019-04-17 13:29:25 -07:00
Brian Vaughn
75e1e1431b Expanded the reorder tests slightly 2019-04-17 13:11:18 -07:00
Brian Vaughn
634d4fece2 Added more inline comments 2019-04-17 13:03:18 -07:00
Brian Vaughn
29d43a2230 Merge pull request #171 from bvaughn/improve-contrast-light-mode
Improve contrast for light mode
2019-04-17 11:44:25 -07:00
Brian Vaughn
3fb9f6cdaa Improve contrast for light mode 2019-04-17 11:40:55 -07:00
Brian Vaughn
c107e03132 Flow fix 2019-04-17 09:45:03 -07:00
Brian Vaughn
74be389124 Fixed a bug with re-ordering of children within a collapsed node 2019-04-17 09:39:54 -07:00
Brian Vaughn
178e89927a Fixed some edge cases with collapsed by default. Still some bugs existing. 2019-04-17 07:45:33 -07:00
Brian Vaughn
037bb0034c Throw if root node is collapsed 2019-04-16 14:10:06 -07:00
Brian Vaughn
4b64d7c017 Support configurable node/tree collapsed by default behavior 2019-04-16 13:59:36 -07:00
Dan Abramov
85179fe4a7 Merge pull request #164 from gaearon/fix-lots-of-stuff
Fix reordering and Suspense logic
2019-04-16 19:11:28 +01:00
Dan Abramov
3a6d656090 Remove unnecessary condition 2019-04-16 19:10:39 +01:00
Dan Abramov
9182d0b0aa Bump alpha to get Andrew's fix 2019-04-16 19:09:52 +01:00
Dan Abramov
58bb7cea41 Remove unused lines 2019-04-16 18:21:40 +01:00
Dan Abramov
8576c85b0d Move stress tests to their own file 2019-04-16 18:10:15 +01:00
Dan Abramov
d4db178d33 Bump to canary 2019-04-16 17:39:26 +01:00
Dan Abramov
3cf67ab859 Harden the tests and fix Flow 2019-04-16 17:02:42 +01:00
Dan Abramov
b1dea26251 Fix the remaining issue when primary child is null
This lets us unlock the rest of the Suspense test.
2019-04-16 16:57:10 +01:00
Dan Abramov
fe21ee7ca0 Enable part of Suspense test that was failing before
This PR fixes it.
2019-04-16 16:47:26 +01:00
Dan Abramov
f4e223bceb When resetting Suspense children, use the fallback child set if needed
This fixes the bug I introduced in the previous refactor which Suspense test caught.
2019-04-16 16:45:56 +01:00
Dan Abramov
dd935ea178 Propagate the need to reset children to closest visible Fiber
This fixes the bug.
2019-04-16 16:34:08 +01:00
Dan Abramov
57e8513a30 Refactor: remove early returns from updateFiberRecursively
This doesn't change any logic, just the shape of the control flow.
I want to unify some branches at the end, so it's easier if there are no early returns.
2019-04-16 16:34:08 +01:00
Dan Abramov
f4c3008cf5 Refactor: split recordUpdate() into profiling and reorder
This doesn't change the actual algorithm but splits unrelated parts.
2019-04-16 16:34:08 +01:00
Dan Abramov
b081ffc518 Add stress test for reordering 2019-04-16 16:34:08 +01:00
Brian Vaughn
20193f03c0 Merge pull request #162 from gaearon/suspense-test
Add Suspense stress test
2019-04-16 07:49:11 -07:00
Dan
d89f79d6e6 Add Suspense stress test 2019-04-16 00:14:49 +01:00
Brian Vaughn
8c974ae432 Flow and lint fix 2019-04-15 09:43:52 -07:00
Brian Vaughn
97636fa7fc Merge pull request #161 from gaearon/fast
Don't materialize typed array until the transfer
2019-04-15 09:40:33 -07:00
Brian Vaughn
2b3ecc63b3 Merge pull request #158 from gaearon/stress-test
Add a stress test for tree traversal
2019-04-15 09:34:40 -07:00
Dan Abramov
6b9b80faac Don't materialize typed array until the transfer 2019-04-15 16:27:19 +01:00
Brian Vaughn
b3546e0e02 Merge pull request #160 from gaearon/add-prod-shell
Add production mode to dev shell
2019-04-15 07:40:39 -07:00
Dan Abramov
947e3c2c04 Add production mode to dev shell 2019-04-15 15:39:25 +01:00
Brian Vaughn
7489b8508b Merge pull request #159 from gaearon/l-to-the-r-to-the-u
Use LRU for encoded strings
2019-04-15 07:09:10 -07:00
Dan Abramov
255385d255 Use LRU for encoded strings 2019-04-15 14:42:12 +01:00
Dan
f569d27f86 Add a stress test for tree traversal 2019-04-15 01:52:15 +01:00
Brian Vaughn
b76372c93d Fixed an edge case profiling bug where the number of commits was wrong 2019-04-13 18:29:39 -07:00
Brian Vaughn
7f6fdfea95 Add package commands for creating dev builds for easier debugging 2019-04-13 18:25:56 -07:00
Brian Vaughn
00f6466ec1 Temporarily disabled hooks lint failure for Tree useEffect 2019-04-13 15:49:06 -07:00
Brian Vaughn
97f089bdfe Merge pull request #148 from gaearon/scroll-consistent
Consistently scroll component name into view
2019-04-13 15:39:25 -07:00
Brian Vaughn
518f3d75f8 Tweaked an inline comment. 2019-04-13 15:38:56 -07:00
Brian Vaughn
b2cf896e8c Fixed misplaced padding in Tree 2019-04-13 15:33:10 -07:00
Brian Vaughn
236f47f073 Tweaked .eslintignore and .gitignore 2019-04-13 15:32:26 -07:00
Brian Vaughn
86f9293376 Merge pull request #154 from gaearon/resize-hilite
Adjust highlighting on window resize
2019-04-13 15:25:17 -07:00
Brian Vaughn
d5266f9409 Merge pull request #155 from gaearon/view-dom-inspect
View DOM button opens Elements tab
2019-04-13 15:23:09 -07:00
Brian Vaughn
453a06a465 Merge pull request #150 from gaearon/bump-hooks-plugin
Bump React Hooks plugin
2019-04-13 15:20:08 -07:00
Brian Vaughn
826cac0070 Merge pull request #149 from gaearon/dont-reset
Don't reset selected item on search mismatch or exit
2019-04-13 15:19:38 -07:00
Dan
ce335b8975 View DOM button opens Elements tab 2019-04-13 18:59:47 +01:00
Dan
6d53a2ec10 Adjust highlighting on window resize 2019-04-13 18:24:59 +01:00
Dan
9162b7165a Prefer to keep the start anchor visible 2019-04-13 16:49:10 +01:00
Dan
6d70028a26 Bump React Hooks plugin 2019-04-13 16:38:34 +01:00
Dan
55dcfe25e8 Don't reset selected item on search mismatch or exit 2019-04-13 16:20:16 +01:00
Brian Vaughn
ca7eb3c829 Changed highlight-on-search behavior to use TreeContext 2019-04-12 18:14:46 -07:00
Dan Abramov
097d0386b1 Track search navigation in DOM 2019-04-12 18:14:46 -07:00
Brian Vaughn
7145c78325 Merge pull request #147 from gaearon/no-propagation
Polish some mouse interactions
2019-04-12 18:09:16 -07:00
Dan
ba9c763954 Consistently scroll component name into view 2019-04-13 01:58:05 +01:00
Dan
454bcf1e01 Polish some mouse interactions 2019-04-13 01:07:35 +01:00
Brian Vaughn
1e08261975 Added missing instruction to Chrome install steps 2019-04-12 15:08:14 -07:00
Brian Vaughn
818255dfde Merge pull request #145 from bvaughn/deploy-chrome-updates
Auto-update Chrome extension
2019-04-12 15:02:11 -07:00
Brian Vaughn
801bb5e33a Udpated Firefox installation instructions 2019-04-12 14:45:39 -07:00
Brian Vaughn
670d1348f1 Chrome build+deploy script auto-increment a prerelease version 2019-04-12 14:42:34 -07:00
Brian Vaughn
26361427ae Auto-update Chrome extension 2019-04-12 13:46:05 -07:00
Brian Vaughn
9c1dad5059 react-window 1.8.0 2019-04-12 10:57:56 -07:00
Brian Vaughn
b18c836ef5 Merge branch 'smart-scroll' of https://github.com/gaearon/react-devtools-experimental into gaearon-smart-scroll 2019-04-12 10:56:27 -07:00
Brian Vaughn
dbd1d6b0bd Firefox only supports peristent background extensions so I've removed the persistent:false flag 2019-04-12 10:20:23 -07:00
Dan Abramov
403f150ade Use smart scrolling 2019-04-12 18:13:26 +01:00
Brian Vaughn
8f17ade7e5 Circle CI config changes 2019-04-12 09:27:53 -07:00
Brian Vaughn
af8a5d9311 Added devEngines entry to package.json 2019-04-12 09:24:16 -07:00
Brian Vaughn
a57b6dbef5 Merge pull request #133 from bvaughn/tests
Automated tests [WIP]
2019-04-12 09:22:11 -07:00
Brian Vaughn
be930d5490 Use Circle CI to run lint, prettier, flow, and tests 2019-04-12 09:17:42 -07:00
Brian Vaughn
7bb2299de4 Moved __DEV__ setup from setupTests to setupEnv 2019-04-12 08:55:29 -07:00
Brian Vaughn
e0ffa2b88d Moved a few vars inside of the setupTest beforeEach block 2019-04-12 08:55:29 -07:00
Brian Vaughn
158b0b5567 Added expand/collapse tests; chronologically ordered snapshots 2019-04-12 08:55:29 -07:00
Brian Vaughn
16a7119bf2 Added a simple Suspense test 2019-04-12 08:55:29 -07:00
Brian Vaughn
4ad85b26c0 Cleaned up setup/polyfills 2019-04-12 08:55:29 -07:00
Brian Vaughn
81183b1492 Named snapshots. Tests use act() abstraction. 2019-04-12 08:55:29 -07:00
Brian Vaughn
5d6a2082cc Updated React test utils for newer version of act() 2019-04-12 08:55:29 -07:00
Brian Vaughn
1bdae952b5 Added separate mount+update tests 2019-04-12 08:55:29 -07:00
Brian Vaughn
25e918b4d9 Added [root] indicator to Store snapshot reprensentation 2019-04-12 08:55:29 -07:00
Brian Vaughn
4926d160d6 Removed unnecessary configurable Bridge batch duration 2019-04-12 08:55:29 -07:00
Brian Vaughn
9fb794b6ed Added multi-test setup logic 2019-04-12 08:55:29 -07:00
Brian Vaughn
7621df5baf Initial example test. Will iterate from here. 2019-04-12 08:55:29 -07:00
Brian Vaughn
7aadcdf624 Use :hidden attribute to collapse props/hooks 2019-04-12 08:53:41 -07:00
Brian Vaughn
ae7ea00e06 Fix small sizing issue with expand collapse toggle 2019-04-12 08:42:27 -07:00
Brian Vaughn
da4accda31 Added expand/collapse toggles to custom hooks 2019-04-12 08:39:03 -07:00
Brian Vaughn
94810b2b5a Add Git revision to extension manifests 2019-04-11 19:06:07 -07:00
Brian Vaughn
9a0cf68a4d Add Git revision to build version 2019-04-11 18:44:44 -07:00
Brian Vaughn
3ea5fac959 Enable text to wrap within error boundary stacks 2019-04-11 18:29:06 -07:00
Brian Vaughn
f32b65d7b0 Merge pull request #135 from lucasecdb/fiber-info-overflow
Fix fiber info sidepanel not scrollable
2019-04-11 18:21:57 -07:00
Lucas Cordeiro
2671e7e0e0 Fix fiber info sidepanel not scrollable 2019-04-11 21:38:57 -03:00
Brian Vaughn
9642d26674 Added ErrorBoundary with GitHub bug link 2019-04-11 17:19:16 -07:00
Dan Abramov
da508fc23f Merge pull request #126 from bvaughn/js-hover
Ignore hover when navigating with keyboard
2019-04-12 01:16:26 +01:00
Brian Vaughn
367249c175 Don't drill into owners list if no owner metadata is available 2019-04-11 14:00:27 -07:00
Brian Vaughn
75657c81e8 Merge branch 'keyboard-stuff' of https://github.com/gaearon/react-devtools-experimental 2019-04-11 11:55:39 -07:00
Dan Abramov
38b7cf5693 Ignore hover when navigating with keyboard 2019-04-11 13:27:49 +01:00
Dan Abramov
0281a0d905 Add a missing dep 2019-04-11 13:20:32 +01:00
Brian Vaughn
a5eb96fbc0 Merge pull request #134 from sophiebits/bridge-batch
Improve bridge batching logic
2019-04-10 17:21:30 -07:00
Sophie Alpert
7c13ea2f2b Improve bridge batching logic
Fixes #132.
2019-04-10 16:31:11 -07:00
Brian Vaughn
40469a190e Fixed horizontal alignment for collapsable hooks 2019-04-10 12:47:51 -07:00
Brian Vaughn
84a5a13525 Editable name not text-selectable 2019-04-10 12:37:20 -07:00
Brian Vaughn
e9f385591e Double clicking on a name toggles expanded state in KeyValue 2019-04-10 12:36:26 -07:00
Brian Vaughn
4f254c0a05 Refactored KeyValue toggle so columns with toggles align better below those without 2019-04-10 11:44:45 -07:00
Dan Abramov
952c8cda00 Fix a bug that caused it to jump over nodes when pressing too fast 2019-04-10 19:30:45 +01:00
Brian Vaughn
f0fb1805fe Added new color-expand-collapse-toggle CSS var 2019-04-10 11:03:32 -07:00
Brian Vaughn
3e19b164b5 Merge branch 'collapse-props' of https://github.com/lucasecdb/react-devtools-experimental into lucasecdb-collapse-props 2019-04-10 11:03:04 -07:00
Lucas Cordeiro
944a6192e2 Use button instead of div for a11y 2019-04-10 15:01:05 -03:00
Dan Abramov
6420f11d65 Left and right arrows only traverse parents 2019-04-10 18:49:52 +01:00
Lucas Cordeiro
2d516199ea Update opener icon and remove negative margin 2019-04-10 14:47:39 -03:00
Brian Vaughn
0aacc2547e Merge pull request #123 from gaearon/focus-keyboard
Picking a DOM node focuses the tree
2019-04-10 10:31:05 -07:00
Lucas Cordeiro
99a1e07aa6 Fix flow type 2019-04-10 14:28:48 -03:00
Lucas Cordeiro
0f955980a3 Add collapsible icon for object and array types 2019-04-10 14:28:48 -03:00
Dan Abramov
1c381c588a Picking a DOM node focuses the tree 2019-04-10 18:27:40 +01:00
Brian Vaughn
88e51adc35 Merge pull request #122 from gaearon/prevent
Prevent default on all key navigations
2019-04-10 10:17:12 -07:00
Brian Vaughn
4b0424fbed Flow fix 2019-04-10 10:16:09 -07:00
Brian Vaughn
268a7cb5b4 Moved blur/focus up to the AutoSizer wrapper and removed an effect+ref 2019-04-10 10:14:21 -07:00
Brian Vaughn
caa74472f2 Replaced nested ternary 2019-04-10 10:01:03 -07:00
Brian Vaughn
6836f15924 Tweaked inactive CSS colors 2019-04-10 09:56:21 -07:00
Brian Vaughn
d9ef0839a4 Merge branch 'inactive-window' of https://github.com/lucasecdb/react-devtools-experimental into lucasecdb-inactive-window 2019-04-10 09:51:29 -07:00
Dan Abramov
5b480a85cb Prevent default on all key navigations 2019-04-10 17:46:34 +01:00
Brian Vaughn
11c03bf7bc Merge pull request #120 from gaearon/mutation-index
Update selected index after mutation
2019-04-10 09:35:00 -07:00
Brian Vaughn
7263e768e5 Merge pull request #116 from bvaughn/issues/105
Add collapse/toggle UI to Tree
2019-04-10 09:31:12 -07:00
Brian Vaughn
56be358847 Merge pull request #114 from gaearon/lazy-sync
Send the bridge sync event lazily
2019-04-10 09:28:54 -07:00
Dan Abramov
f1a8bd2923 Update selected index after mutation 2019-04-10 17:28:36 +01:00
Brian Vaughn
f89f2b2146 Reverted misguided index/collapsed behavior 2019-04-10 09:23:24 -07:00
Brian Vaughn
ba46f2df0a Merge pull request #118 from gaearon/required-title
Add missing Button titles
2019-04-10 09:10:24 -07:00
Brian Vaughn
98240f18ae Merge pull request #117 from gaearon/hide-shell
Put DevTools in dev shell above the inspector
2019-04-10 09:10:10 -07:00
Brian Vaughn
74c9904e5d Rewrote weightDelta calculation to be more readable based on PR feedback 2019-04-10 08:59:43 -07:00
Brian Vaughn
dd84e8ff2b Newly selected components always auto-expand their ancestors 2019-04-10 08:57:42 -07:00
Brian Vaughn
1f7f0ea691 Update Store.getIndexOfElementID to take isCollapsed into account 2019-04-10 07:53:06 -07:00
Brian Vaughn
b004a79415 Reverted some unnecessary changes to TreeContext after Dan's PR 101 was merged 2019-04-10 07:45:45 -07:00
Brian Vaughn
102267b1d6 Renamed _numElements attribute based on PR feedback 2019-04-10 07:42:32 -07:00
Brian Vaughn
61203f77cf Hide toggle arrows in owners list mode 2019-04-10 07:42:32 -07:00
Brian Vaughn
55b3635f28 Left/right arrow toggles node collapsed state as well 2019-04-10 07:42:32 -07:00
Brian Vaughn
f7212d8035 Upgrade react-window to fix a scroll-to bug 2019-04-10 07:42:32 -07:00
Brian Vaughn
4c522c4c38 Selected search result auto-opens collapsed nodes when necessary.
Also fixed an unrelated bug about when we reset search index when text changes.
2019-04-10 07:42:32 -07:00
Brian Vaughn
b6df86c90c Added toggle button to Tree > Element views 2019-04-10 07:38:40 -07:00
Brian Vaughn
79827c535b Added isToggled boolean to tree nodes and toggleIsCollapsed() method to Store 2019-04-10 07:38:40 -07:00
Brian Vaughn
0decb17837 Merge pull request #101 from gaearon/find-nit
Pressing next forces search to select
2019-04-10 07:38:28 -07:00
Dan Abramov
1102fc5c11 Refactor: extract a variable 2019-04-10 15:25:03 +01:00
Dan Abramov
3eca0bbe61 Use heuristic suggested by @sophiebits 2019-04-10 15:08:13 +01:00
Dan
07299828c9 Pressing next forces search to select 2019-04-10 14:57:39 +01:00
Dan Abramov
75a4312d87 Add missing Button titles 2019-04-10 14:40:41 +01:00
Dan Abramov
84478a41ff Put DevTools in dev shell above the inspector 2019-04-10 14:26:33 +01:00
Brian Vaughn
6d222080ad Format logElementToConsole() slightly 2019-04-09 18:13:11 -07:00
Lucas Cordeiro
1c57ca0a1c Use focus state from elements tree instead of ownerDocument 2019-04-09 19:04:03 -03:00
Lucas Cordeiro
26106a4b9d Add check for inactive window on selected element 2019-04-09 19:03:59 -03:00
Dan Abramov
43bb821f60 Send the bridge sync event lazily 2019-04-09 20:04:33 +01:00
Brian Vaughn
edc598e62a Fixed Tree minWidth initial case to fill 100% width 2019-04-09 11:43:49 -07:00
Brian Vaughn
1cc219009a Tweaked owners stack CSS to fix another overflow issue 2019-04-09 11:12:39 -07:00
Brian Vaughn
49f6a22b5b Remember max Tree width as new nested items are rendered 2019-04-09 10:58:43 -07:00
Brian Vaughn
d6bd3dc503 Fixed owner stack size calculation bug that sometimes caused bad overflow 2019-04-09 10:18:04 -07:00
Brian Vaughn
f1fc4b0331 Merge pull request #108 from bvaughn/reach-ui-menubutton
Use @reach MenuButton for owner stack menu [WIP]
2019-04-09 08:58:08 -07:00
Brian Vaughn
dbf6942512 Added (local) fork of @reach/portal to unblock OwnersStack MenuButton PR 2019-04-09 08:54:43 -07:00
Brian Vaughn
a29ab9ab79 Tree arrow navigation respects event.defaultPrevented
This prevents Reach MenuButton operations from also changing the tree selection in the background
2019-04-09 08:37:34 -07:00
Brian Vaughn
163bc234df Disable text selection for OwnersStack buttons 2019-04-09 08:36:54 -07:00
Brian Vaughn
db629fa073 Updated OwnersStack CSS to properly override React styles 2019-04-09 08:30:24 -07:00
Dan Abramov
4bde8f6503 Merge pull request #103 from gaearon/sad-one-way
Make DOM selection binding one-way
2019-04-09 13:25:08 +01:00
Dan Abramov
153666b484 Merge pull request #107 from sophiebits/flicker
pointer-events: none to fix flicker on Overlay "tip"
2019-04-09 11:40:47 +01:00
Brian Vaughn
ba99444515 Use @reach MenuButton for owner stack menu 2019-04-08 18:34:48 -07:00
Sophie Alpert
a2d84fa613 pointer-events: none to fix flicker on Overlay "tip"
If click-to-inspect then hover an element in just the right place, it flickers between two elements because this "tip" element catches the hover. This should fix it.
2019-04-08 18:26:30 -07:00
Dan
72eccb465d Make DOM selection binding one-way 2019-04-09 01:30:40 +01:00
Dan Abramov
267ab34fbd Merge pull request #99 from gaearon/sync-tabs
Sync DevTools Elements and Components tabs
2019-04-08 23:55:16 +01:00
Dan
3b793953b1 Keep DOM selection if last $0 resolves to same component 2019-04-08 23:46:47 +01:00
Dan
436912ab2d Remove unnecessary logic 2019-04-08 23:35:01 +01:00
Dan
7aecd58d81 Nits 2019-04-08 23:28:31 +01:00
Dan
c91676b557 Don't change browser selection unless React selection changed 2019-04-08 21:57:13 +01:00
Brian Vaughn
5db5e40bf1 Replaced Agent setInterval with throttle+memoize 2019-04-08 13:50:04 -07:00
Dan Abramov
388677fcbc Merge branch 'master' into continuous-select 2019-04-08 20:50:58 +01:00
Dan Abramov
4a301bd0e0 Sync DevTools Elements and Components tabs 2019-04-08 20:41:01 +01:00
Brian Vaughn
44ecff31e3 Fixed an unpleasant interaction with owners modal "..." button 2019-04-08 12:20:45 -07:00
Brian Vaughn
e43cfa0239 Don't re-measure owners stack sizes unnecessarily 2019-04-08 12:05:07 -07:00
Brian Vaughn
174125c854 Merge branch 'master' of github.com:bvaughn/react-devtools-experimental 2019-04-08 11:41:56 -07:00
Brian Vaughn
58ae3c63a8 Added export-log icon. Removed unnecessary variable assignment. 2019-04-08 11:41:25 -07:00
Dan Abramov
ab89d6500f Fix missing key 2019-04-08 19:01:28 +01:00
Brian Vaughn
fefb2bc99b Merge branch 'inspect-log' of https://github.com/gaearon/react-devtools-experimental into gaearon-inspect-log 2019-04-08 10:41:58 -07:00
Brian Vaughn
b3ba758798 Updated flow-bin 2019-04-08 10:40:46 -07:00
Brian Vaughn
7115408751 Added for itemData 2019-04-08 10:40:40 -07:00
Dan Abramov
5b120d6b24 Add a separate button for logging values 2019-04-08 18:39:37 +01:00
Dan Abramov
b176cd4414 Refactor: split inspectElementRaw 2019-04-08 18:37:36 +01:00
Brian Vaughn
14105e865a Merge pull request #92 from gaearon/highlight-on-hover
Select DOM nodes on hover
2019-04-08 10:23:56 -07:00
Dan Abramov
52014671bf Make Flow happy 2019-04-08 18:03:48 +01:00
Dan Abramov
c6ee445ea9 Address review 2019-04-08 18:00:48 +01:00
Dan Abramov
6538e7141a Add a comment 2019-04-08 17:58:12 +01:00
Dan Abramov
39223239bb Select DOM nodes on hover 2019-04-08 17:58:12 +01:00
Dan Abramov
cb164eb9fb Merge pull request #91 from gaearon/fix-scroll
Fix spurious autoscroll
2019-04-08 17:51:35 +01:00
Brian Vaughn
c619d56b1c Merge pull request #93 from gaearon/keep-mounted
Preserve state when switching tabs
2019-04-08 08:43:31 -07:00
Brian Vaughn
e86d7b51ea Merge pull request #94 from gaearon/rendered-by
Rename "owner stack" label to "rendered by"
2019-04-08 08:20:56 -07:00
Dan Abramov
edfab66104 Rename "owner stack" label to "rendered by" 2019-04-08 15:40:40 +01:00
Dan Abramov
132529da79 Preserve state when switching tabs 2019-04-08 15:29:51 +01:00
Dan
0a6d637619 Fix spurious autoscroll 2019-04-08 00:51:31 +01:00
Brian Vaughn
2ba3ee6c1c Merge pull request #86 from gaearon/owner-stack-id
Preserve selection on exiting owner mode
2019-04-07 15:42:43 -07:00
Brian Vaughn
7e2ef6a34e Merge pull request #87 from gaearon/bump-overscan
Bump overscan to 3
2019-04-07 15:36:20 -07:00
Brian Vaughn
77267e8544 Fixed Toggle Flow prop types 2019-04-07 15:34:35 -07:00
Brian Vaughn
f61507158e Merge branch 'hristo-kanchev-owner-stack-enhancement' 2019-04-07 15:33:42 -07:00
Brian Vaughn
e489c8ac8e Owners stack modal behaves and looks more like a modal 2019-04-07 15:32:13 -07:00
Brian Vaughn
2ac815784b Removed unnecessary layout effect in favor of a setState 2019-04-07 15:19:17 -07:00
Dan Abramov
a9c20f0b36 Merge pull request #88 from gaearon/remove-ring
Remove tree focus ring
2019-04-07 20:16:06 +01:00
Brian Vaughn
ae2e8128bd Merge pull request #89 from gaearon/toggle-fix
Pass Toggle label through
2019-04-07 10:54:35 -07:00
Dan
5a118701b0 Pass Toggle label through 2019-04-07 18:44:11 +01:00
Brian Vaughn
2e5e88e127 Cleaned up is-overflowing hook and dependencies 2019-04-07 10:34:44 -07:00
Dan
2607b39fe1 Remove tree focus ring 2019-04-07 18:20:34 +01:00
Brian Vaughn
5b6dbb8dd7 Replaced some passive effects with layout effects to avoid flash of overflowed owners 2019-04-07 10:01:18 -07:00
Brian Vaughn
df00a9639e Removed some unnecessary functions 2019-04-07 09:58:34 -07:00
Dan
a42a3a2d72 Bump overscan 2019-04-07 17:55:27 +01:00
Brian Vaughn
850dda0fb9 Cleaned up an old Overlay helper function 2019-04-07 09:53:34 -07:00
Brian Vaughn
252a87efe5 Use 'classnames' in TabBar to simplify an attribute 2019-04-07 09:51:54 -07:00
Brian Vaughn
9255ad1025 Replaced "colon" icon with more standard 3-dot "more" 2019-04-07 09:46:44 -07:00
Dan
f2951fb51f Preserve selection on exiting owner mode 2019-04-07 17:43:10 +01:00
Brian Vaughn
9a2f9ac880 Moved getElementDimensions() back into Overlay component 2019-04-07 09:42:52 -07:00
Brian Vaughn
d686b9d890 Merge branch 'owner-stack-enhancement' of https://github.com/hristo-kanchev/react-devtools-experimental into hristo-kanchev-owner-stack-enhancement 2019-04-07 09:13:33 -07:00
Brian Vaughn
2b868821d5 Improved keyboard navigation for tabs, interactions, and fiber-commits 2019-04-07 09:00:52 -07:00
Brian Vaughn
44c0febd23 Profiler shows commit times and durations for selected fiber 2019-04-07 08:36:37 -07:00
Hristo Kanchev
2620050abf Removed unneeded min-height. Using throttle for resize function. 2019-04-07 11:48:35 +02:00
Hristo Kanchev
ce04f531d4 Implemented new OwnerStack UI enhancement 2019-04-07 11:37:12 +02:00
Brian Vaughn
5334249bda Fixed a typo in flamegraph duration label 2019-04-06 18:01:44 -07:00
Brian Vaughn
d766d3b2e5 Throttle screenshots to reduce impact on performance. 2019-04-06 13:58:55 -07:00
Brian Vaughn
bfcef10af3 Merge pull request #84 from gaearon/dead
Remove dead code
2019-04-06 13:37:50 -07:00
Dan
9fc2a3400c Remove dead code 2019-04-06 21:36:08 +01:00
Dan
99593444b9 Address review 2019-04-06 21:30:57 +01:00
Dan
785bb9f56c Continuously update tree selection in DOM inspection mode 2019-04-06 20:27:36 +01:00
Dan Abramov
985fe59826 Merge pull request #81 from gaearon/overlay-owner
Show owner in DOM highilght overlay
2019-04-06 18:26:50 +01:00
Dan
5eec8aed33 Nit 2019-04-06 18:26:17 +01:00
Dan
ab9c1b84c8 Show owner in DOM highilght overlay 2019-04-06 17:07:06 +01:00
Dan Abramov
72d9f0597a Merge pull request #71 from gaearon/suspense-special
Fix Suspense fragment edge cases
2019-04-05 23:59:17 +01:00
Dan
d3d5c050bd Naming 2019-04-05 23:45:34 +01:00
Dan
7a03c5a885 Update the commit tree to assume operations do not repeat 2019-04-05 23:42:02 +01:00
Dan
80d9d8d841 Fix profiler and nits 2019-04-05 23:34:27 +01:00
Dan
0f536bba5c Rewrite the Suspense logic 2019-04-05 23:12:57 +01:00
Dan Abramov
d6257d382d Expand the test fixture 2019-04-05 21:49:37 +01:00
Dan
9bcd5b2576 Fix Suspense fragment edge cases 2019-04-05 21:49:37 +01:00
Dan Abramov
387ad54d80 Merge pull request #75 from gaearon/fix-double-add
Fix double-adding fibers when traversing
2019-04-05 18:45:42 +01:00
Dan Abramov
2a5b8a9206 Hard crash 2019-04-05 18:41:26 +01:00
Dan Abramov
96a7adf49e Add error logs in __DEBUG__ 2019-04-05 18:27:02 +01:00
Dan Abramov
9170e5695a Fix double-adding fibers when traversing 2019-04-05 18:18:39 +01:00
Brian Vaughn
0c8129c78a Sync selected Profiler node back to the Components tab
Also show element keys in Profiler charts
2019-04-05 08:47:23 -07:00
Brian Vaughn
d1a5346c48 Improved keyboard UX and focus UI for Tree and OwnersStack 2019-04-05 08:08:02 -07:00
Dan Abramov
632647fbac Merge pull request #61 from gaearon/toggle-suspense-2
Allow to toggle Suspense in Components pane
2019-04-05 13:22:41 +01:00
Dan
b8245de5a1 Nits 2019-04-05 13:19:39 +01:00
Dan Abramov
48a5aca127 Fix highlighting timed out Suspense DOM node 2019-04-05 13:19:35 +01:00
Dan Abramov
4f5437edf7 Allow to toggle Suspense in Components pane 2019-04-05 13:19:30 +01:00
Brian Vaughn
bfbb4ac545 Merge pull request #72 from gaearon/search-bug
Don't move selection unless search text increased length
2019-04-04 17:55:12 -07:00
Dan
a8e46c67e6 Don't move selection unless search text increased length 2019-04-05 00:49:27 +01:00
Brian Vaughn
16951fe7fb Merge pull request #70 from gaearon/free-debug
Explicitly guard debug calls
2019-04-04 16:12:45 -07:00
Dan
2928a0be74 Explicitly guard debug calls 2019-04-05 00:03:17 +01:00
Brian Vaughn
9b05184ccb Merge pull request #63 from gaearon/smarter-search-match
Match search at word boundaries
2019-04-04 14:41:08 -07:00
Brian Vaughn
6c5c2cd3ad Renamed innerElementType -> InnerElementType to avoid confusing hooks lint rule 2019-04-04 14:10:14 -07:00
Brian Vaughn
8d435595cd Added truncation UI indicator for hooks. Addressed lint rule violations. 2019-04-04 14:09:10 -07:00
Brian Vaughn
11d068d794 Merge branch 'fix-nested-hooks' of https://github.com/gaearon/react-devtools-experimental into gaearon-fix-nested-hooks 2019-04-04 13:54:41 -07:00
Brian Vaughn
64b0fd8ecd Fixed owners header font family too 2019-04-04 13:52:53 -07:00
Brian Vaughn
43782e6696 Merge branch 'larger-items' of https://github.com/gaearon/react-devtools-experimental into gaearon-larger-items 2019-04-04 13:48:24 -07:00
Brian Vaughn
93f83d27dd Merge pull request #66 from gaearon/dont-dismiss-menu
Stop mouseup propagation while inspecting
2019-04-04 13:47:59 -07:00
Dan Abramov
9351c8070d Fix it all 2019-04-04 19:54:56 +01:00
Dan Abramov
18e337707a Stop mouseup propagation while inspecting 2019-04-04 19:52:18 +01:00
Dan Abramov
194f523331 Add size to owner stack items 2019-04-04 19:36:04 +01:00
Dan Abramov
8478a526e6 Don't crash for deeply nested Hooks 2019-04-04 19:28:42 +01:00
Brian Vaughn
ded2ce03ee Renamed TreeWrapper to innerElementType 2019-04-04 10:08:48 -07:00
Brian Vaughn
c86793ef18 Merge branch 'a11y-tree' of https://github.com/gaearon/react-devtools-experimental into gaearon-a11y-tree 2019-04-04 09:54:46 -07:00
Dan Abramov
2afda3de37 Add back regex support 2019-04-04 17:05:34 +01:00
Dan Abramov
0f0062a71c Fix special cases 2019-04-04 17:00:35 +01:00
Dan Abramov
39da33a7bf Fix regex 2019-04-04 16:38:49 +01:00
Brian Vaughn
a9fced9b0d Prettier 2019-04-04 08:35:42 -07:00
Brian Vaughn
8c3a97401f Chagned owner div to be actual button 2019-04-04 08:35:25 -07:00
Brian Vaughn
485f389d05 Merge branch 'tab-owner' of https://github.com/gaearon/react-devtools-experimental into gaearon-tab-owner 2019-04-04 08:32:16 -07:00
Dan Abramov
8cfb0e20c7 Match search at word boundaries 2019-04-04 16:22:21 +01:00
Brian Vaughn
14969c24a9 Merge pull request #62 from gaearon/search-fix
Move selection when typing in search field
2019-04-04 08:14:57 -07:00
Dan Abramov
ec71171bec Move selection when typing in search field 2019-04-04 15:59:06 +01:00
Dan
b1c675b8b1 Make owner stack reachable by keyboard 2019-04-04 09:56:37 +01:00
Brian Vaughn
7fbdfd9f5a Copied findCurrentFiberUsingSlowPath Suspense bug fix from recent PR https://github.com/facebook/react/pull/15312/files 2019-04-03 18:20:18 -07:00
Brian Vaughn
99f2e0da6f Hardened background script against potential errors 2019-04-03 18:16:00 -07:00
Brian Vaughn
ed6e34da8e Added option to disable screenshot capturing while profiling 2019-04-03 14:32:16 -07:00
Brian Vaughn
07bf8e53c1 Renamed GlobalHook content script references to injectGlobalHook to avoid confusion 2019-04-03 11:01:28 -07:00
Dan Abramov
c60f991d87 Make tree reachable by focus 2019-04-03 19:01:04 +01:00
Brian Vaughn
5b879ac095 Fixed a name typo in a radio button 2019-04-03 09:57:13 -07:00
Brian Vaughn
f92d2bbf83 Fixed editing props for memo and forwardRef components 2019-04-03 09:29:33 -07:00
Brian Vaughn
5bc5e31cee Merge pull request #51 from gaearon/tweak-el-display
Add a space in <Foo />
2019-04-03 09:09:11 -07:00
Dan Abramov
b2cd77d2e6 Add a space in <Foo /> 2019-04-03 17:04:31 +01:00
Brian Vaughn
6493db4acc Fixed an arrow navigation bug 2019-04-03 08:12:43 -07:00
Brian Vaughn
6772f2a9e1 Revert fa317be (temporarily show previously selected element props) 2019-04-03 07:52:30 -07:00
Brian Vaughn
d1a68c4b14 Merge pull request #45 from gaearon/rename
Tab name: "Elements" -> "Components"
2019-04-02 17:55:01 -07:00
Brian Vaughn
c111288c54 Store screenshots after each commit when profiling 2019-04-02 15:04:04 -07:00
Dan Abramov
83bd211c9e Elements -> Components (naming) 2019-04-02 19:58:18 +01:00
Dan Abramov
de730da230 Elements -> Components (label) 2019-04-02 19:54:22 +01:00
Brian Vaughn
f415e2447e Added missing Flow annotation 2019-04-02 11:53:18 -07:00
Brian Vaughn
fa317bed61 Merge pull request #41 from gaearon/smoother-right-pane
Avoid flashing "Loading..." in right pane
2019-04-02 10:09:43 -07:00
Brian Vaughn
b8ada905ff Merge pull request #35 from bvaughn/reload-and-profile
Eagerly inject renderer (before document) to support reload-and-profile
2019-04-01 14:47:51 -07:00
Brian Vaughn
2a80f8ca9c Show is-recording indicator earlier after a reload-and-profile 2019-04-01 14:43:46 -07:00
Brian Vaughn
f5f7cb5bdf Fixed some missing operations that could happen after reload-and-profile 2019-04-01 14:29:52 -07:00
Brian Vaughn
74cd1a5d29 Misc cleanup of comments and localStorage key names 2019-04-01 09:05:40 -07:00
Brian Vaughn
2c14f3e88e Inject early on when reloading-and-profiling 2019-04-01 07:48:14 -07:00
Brian Vaughn
37ed5a7175 Merge pull request #38 from lucasecdb/patch-1
Fix casing on store import
2019-04-01 07:25:03 -07:00
Lucas Cordeiro
e634777027 Fix casing on store import 2019-04-01 10:25:57 -03:00
Brian Vaughn
628c1b2f08 Disable export profiling data option in Firefox. (downloads.download seems to just fail silently.) 2019-03-31 19:18:06 -07:00
Brian Vaughn
bfb152f160 Import/export feature 2019-03-31 17:02:30 -07:00
Brian Vaughn
e5400f76f0 Added save profiling data button to Profiler 2019-03-30 14:16:34 -07:00
Brian Vaughn
7cac619c68 Added initial support for EventComponent/EventTarget 2019-03-30 09:02:02 -07:00
Brian Vaughn
7bd8c02f10 Added export and clear buttons for Profiler, cleaned up record toggle 2019-03-30 09:01:52 -07:00
Dan Abramov
b223ec3b39 Avoid flashing "Loading..." in right pane 2019-03-29 23:58:42 -07:00
Brian Vaughn
a450a23e31 Improved Profiler suspense boundary UI 2019-03-29 08:53:39 -07:00
Brian Vaughn
61a251f01a Disable reload-and-profile button if no renderers support profiling 2019-03-27 09:50:19 -07:00
Brian Vaughn
7d24e83989 Implemented reload-and-profile. Also fixed an couple of minor profiling bugs along the way 2019-03-27 09:41:12 -07:00
Brian Vaughn
ea5f310fe1 Webpack config injects a __DEV_ constant 2019-03-26 13:22:55 -07:00
Brian Vaughn
691068b0a3 Suppress horizontal scroll bars in snapshot selector 2019-03-26 11:23:19 -07:00
Brian Vaughn
894990919c Fixed a tab restoration bug in browser extension 2019-03-26 11:13:40 -07:00
Brian Vaughn
3fa951d3c3 Cleaned up a no-selection state 2019-03-25 10:34:22 -07:00
Brian Vaughn
030914fdca Moved some shared CSS vars into CSS 2019-03-25 10:29:25 -07:00
Brian Vaughn
3ba64e5955 Cleaned up edge cases around filtered commits 2019-03-25 10:18:38 -07:00
Brian Vaughn
5718eaf0f3 Added arrow key navigation for commits and interactions 2019-03-24 18:53:59 -07:00
Brian Vaughn
d973452c36 Removed some outdated TODO comments 2019-03-24 10:14:28 -07:00
Brian Vaughn
9d942b486a Show commit boxes in interaxctions sidebar 2019-03-24 09:58:56 -07:00
Brian Vaughn
afba752034 Clicking commits and interactions link to each other 2019-03-24 09:46:54 -07:00
Brian Vaughn
5602fc5371 Added interaction tracing test harness to shell 2019-03-24 09:21:37 -07:00
Brian Vaughn
69cdd38c9d Interaction chart with commit blocks rendering 2019-03-24 09:07:00 -07:00
Brian Vaughn
64e355bb74 Added basic Interactions view (without graph for now) 2019-03-20 11:12:46 -07:00
Brian Vaughn
17a966651c Added suspense to TODO list and added interactions to 'Commit Info' panel 2019-03-20 09:39:14 -07:00
Brian Vaughn
3e82e4152e Added getInteractions message 2019-03-19 18:13:44 -07:00
Brian Vaughn
433b6aadd6 Added placeholder Profiler sidebar views 2019-03-19 12:41:49 -07:00
Brian Vaughn
ac1a986ace Handle RTE in profiler when commit does not contain selected node 2019-03-19 11:19:30 -07:00
Brian Vaughn
1846d4fe59 Fixed a bug where treeBaseDurations were undefined for fibers that were unmounted during profiling 2019-03-19 11:08:51 -07:00
Brian Vaughn
2fc03eb151 Fixed keyboard/mouse events inside of extension by using ref.ownerDocument 2019-03-18 15:11:41 -07:00
Brian Vaughn
b64a76e6bd Reset selected commit and fiber between profiling sessions 2019-03-18 13:53:10 -07:00
Brian Vaughn
9b6ee0bb22 Merge pull request #33 from bvaughn/portals
Experimenting with portals [WIP]
2019-03-18 13:37:56 -07:00
Brian Vaughn
5f154b376e Added profiling-not-supported message for browser extension 2019-03-18 13:37:37 -07:00
Brian Vaughn
be48150fc6 innerTagName -> innerElementType 2019-03-18 10:09:09 -07:00
Brian Vaughn
50b6b1d5f9 Added some inline comments about portal props 2019-03-18 09:57:08 -07:00
Brian Vaughn
e728ebc7b9 Unmount and remount when main URL changes to avoid staleness problems 2019-03-18 09:36:47 -07:00
Brian Vaughn
c9920f0954 Added a few inline comments 2019-03-18 09:20:00 -07:00
Brian Vaughn
2664036dbe Tweaked profiling did-not-render color to be dimmer 2019-03-18 09:18:22 -07:00
Brian Vaughn
11573bf8d9 Refactored portaling and fixed disconnected CSS vars 2019-03-18 09:11:28 -07:00
Brian Vaughn
f3f4643a3a Experimenting with portals 2019-03-17 13:52:37 -07:00
Brian Vaughn
d3ee02cd35 Added "Profiler" tab 2019-03-17 10:58:20 -07:00
Brian Vaughn
d685efd72f Fixed mutation bug in CommitTreeBuilder 2019-03-17 10:25:40 -07:00
Brian Vaughn
c82a7fb560 First pass at flame graph chart 2019-03-17 09:49:10 -07:00
Brian Vaughn
01ad9f1da6 Implemented ranked chart 2019-03-16 14:06:41 -07:00
Brian Vaughn
734e4146e7 Added Ranked chart data generation; fixed some logic errors in backend tree base duration tracking 2019-03-16 10:52:08 -07:00
Brian Vaughn
a93dab7f83 Reset commit tree cache between profiles 2019-03-16 08:50:28 -07:00
Brian Vaughn
821a6504b8 Added commit tree reconstruction 2019-03-15 20:05:52 -07:00
Brian Vaughn
8a7be78ed7 Finished iterating on commit selector UI for now 2019-03-15 11:51:35 -07:00
Brian Vaughn
585c1cb3d2 Refactored Profiler tree to better work with suspense 2019-03-15 10:26:21 -07:00
Brian Vaughn
e8f84dd5c4 Iterating on Profiling tab suspense. Stashing changes but planning to refactor immediately. 2019-03-15 08:34:08 -07:00
Brian Vaughn
210c2371cf Naive pass at commit durationfiltering 2019-03-13 17:00:44 -07:00
Brian Vaughn
8b3546b437 Profiler CSS/layout tweaks 2019-03-13 16:25:29 -07:00
Brian Vaughn
0edf4e9dc1 Plugged react-window into commit selector 2019-03-13 14:57:52 -07:00
Brian Vaughn
b8a52078c6 Added initial Suspense cache and loaded commit metadata 2019-03-12 15:50:29 -07:00
Brian Vaughn
e7e62acbf9 Merge pull request #32 from reznord/fix/long-props-fix
Break the text into next line for long props
2019-03-11 11:26:41 -07:00
Brian Vaughn
f5ba99e6ba Moved some things from ProfilerContext reducer into (root) Store 2019-03-11 11:26:30 -07:00
Anup
896c9a79b2 Fixes #19 - Break the text into next line for long props 2019-03-11 23:37:39 +05:30
Brian Vaughn
22a3c757fb Tidied up Profiler toolbar UI 2019-03-11 09:50:20 -07:00
Brian Vaughn
e5280307c9 Added snapshot selector placeholder UI 2019-03-10 19:16:34 -07:00
Brian Vaughn
565d739569 Added commit time filter 2019-03-10 10:13:20 -07:00
Brian Vaughn
2d68007288 Initial profiling shell added
Lots of TODOs and unfinished views here.
2019-03-10 09:01:05 -07:00
Brian Vaughn
2606d119be Merge branch 'master' of github.com:bvaughn/react-devtools-experimental 2019-03-09 14:09:04 -08:00
Brian Vaughn
c687252b6a Updated Profiling overview/proposal again 2019-03-09 14:08:51 -08:00
Brian Vaughn
a5de36b0c2 Merge pull request #29 from tsriram/fix-import
Fix import file name
2019-03-08 17:41:58 -08:00
Sriram Thiagarajan
3118dae375 fix import file name 2019-03-09 07:03:42 +05:30
Brian Vaughn
5386917f59 Refined OVERVIEW a little more 2019-03-07 14:31:03 -08:00
Brian Vaughn
20b613dcde Updated Profiler OVERVIEW 2019-03-07 14:15:12 -08:00
Brian Vaughn
0ac84f3065 Added explicit Profiler goals to OVERVIEW 2019-03-06 18:30:17 -08:00
Brian Vaughn
4257ba4983 Changed profilerSummary messages to be lazy as well 2019-03-06 18:21:38 -08:00
Brian Vaughn
181e8aff30 Added planned Profiler architecture to OVERVIEW doc to share with others 2019-03-06 18:12:11 -08:00
Brian Vaughn
e9028d1d35 Re-organized views slightly in preparation for Profiler UI 2019-03-06 14:01:52 -08:00
Brian Vaughn
c18449326d Disabled transferrables for now (to avoid a Chrome runtime error) 2019-03-06 13:17:20 -08:00
Brian Vaughn
0db7770cf7 Merged master 2019-03-03 12:41:08 -08:00
Brian Vaughn
235851da87 Merge pull request #27 from gaurav5430/master
Update OVERVIEW.md
2019-03-03 08:14:05 -08:00
Gaurav Gupta
f94401c10e Update OVERVIEW.md
Fixed the superscript reference
2019-03-03 18:29:58 +05:30
Brian Vaughn
515b60cc5e Fixed a typo in OVERVIEW 2019-03-01 08:38:05 -08:00
Brian Vaughn
8aa6f96279 Fixed selecterd element background color being cut-off when tree scrolls
This required a bit of unusual CSS but seems to work well for Firefox and Chrome. We can remove it and revisit other approaches (like PR#24) in the future if needed.
2019-03-01 08:28:16 -08:00
Brian Vaughn
0401f34f55 Removed unnecessary relative position style from Element CSS 2019-02-28 14:50:27 -08:00
Brian Vaughn
90001e892d Udpated param name in injected renderer overrideHookState type 2019-02-28 13:55:49 -08:00
Brian Vaughn
d70dbfdb65 Added intro to OVERVIEW 2019-02-28 13:46:36 -08:00
Brian Vaughn
c249e31932 Fixed docs typo: chlid -> child 2019-02-28 13:26:39 -08:00
Brian Vaughn
7da5f83a28 Updated to account for facebook/react/pull/14906/commits/cdd9ba4 2019-02-28 13:22:27 -08:00
Brian Vaughn
c7f8557202 Improve selected node highlighting by using minWidth instead of width 2019-02-28 12:56:49 -08:00
Brian Vaughn
bffa72c601 Add placeholders to clarify between empty string, null, and undefined 2019-02-28 10:46:17 -08:00
Brian Vaughn
d34a32d389 Disable text selection in tree 2019-02-28 09:44:04 -08:00
Brian Vaughn
d6a2ba2616 Added OVERVIEW doc 2019-02-28 08:52:54 -08:00
Brian Vaughn
bcb6c2fd9f Removed an unnecessary entry from add-root operation array 2019-02-28 08:52:46 -08:00
Brian Vaughn
13ca37384d Maybe fixed checkbox alignment issue Dan reported? 2019-02-27 13:54:53 -08:00
Brian Vaughn
0153eaedee Left arrow selects parent in tree 2019-02-27 13:49:46 -08:00
Brian Vaughn
bf02b2ffbf Select DOM element mode should useCapture to prevent clicks from passing through 2019-02-27 13:33:10 -08:00
Brian Vaughn
05ef0ad7dc Disable view-source button rather than hiding it to avoid jumping when selecting new components 2019-02-27 13:30:03 -08:00
Brian Vaughn
1e4434ecc4 Changed select-on-click to select-on-mouse-down and fixed a scrollIntoView problem 2019-02-27 13:11:23 -08:00
Brian Vaughn
8041bfb92f Add .vscode to .gitignore 2019-02-27 13:07:09 -08:00
Brian Vaughn
bc4e8950f6 Updated test code to include a deeply nested DIV 2019-02-27 13:05:43 -08:00
Brian Vaughn
4d9e7e75c6 Merge branch 'scroll-into-view' of https://github.com/Jessidhia/react-devtools-experimental into Jessidhia-scroll-into-view 2019-02-27 12:58:03 -08:00
Brian Vaughn
89df0a6363 Yarn upgrade 2019-02-24 18:32:29 -08:00
Brian Vaughn
9f24e8c7a2 Renamed overrideHook -> overrideHookState (to stay in sync with React PR) 2019-02-23 09:12:17 -08:00
Brian Vaughn
9b96b1f809 Updated deploy scripts and pre-release template 2019-02-23 08:59:21 -08:00
Brian Vaughn
7b2f06e3d3 Added (temporary) deploy scripts for pre-release extensions 2019-02-22 14:36:10 -08:00
Brian Vaughn
53632883b6 Implemented view-source button for DOM extension 2019-02-22 13:24:03 -08:00
Brian Vaughn
105b53f0fb Split :active and :focus styles for Button+Toggle 2019-02-22 10:54:18 -08:00
Brian Vaughn
5fd9cb5dfb Added copy props/state/hooks/context button 2019-02-22 09:39:05 -08:00
Brian Vaughn
1edbfbf6cb Fixed some small overflow/scrollbar issues 2019-02-22 08:44:05 -08:00
Brian Vaughn
0c346ceea8 Re-added transferrables (after 'shutdown' evt fix) and guard against a tree mutation race 2019-02-21 14:56:11 -08:00
Brian Vaughn
caf2eb973a Split large InspectedElementTree file into separate component-files 2019-02-21 14:20:14 -08:00
Brian Vaughn
9898db02d1 Restore input focus after clicking reset value button 2019-02-21 14:13:48 -08:00
Brian Vaughn
4f64c9ef9e Tweaked colors; Esc key to undo edits 2019-02-21 14:11:06 -08:00
Brian Vaughn
ddeb78001c Tweaked colors based on Andrew's feedback 2019-02-21 14:02:45 -08:00
Brian Vaughn
290e8c6926 Fixed null input value. Tweaked useReducer test harness. 2019-02-21 13:40:23 -08:00
Brian Vaughn
bdf8065137 Merge branch 'master' of github.com:bvaughn/react-devtools-experimental 2019-02-21 13:24:15 -08:00
Brian Vaughn
6f118497e8 Updated editable hooks UI and added limited undo feature 2019-02-21 13:24:01 -08:00
Brian Vaughn
2b27f63a61 Updated ESLint hooks rule 2019-02-21 11:55:28 -08:00
Brian Vaughn
df4a09d9b8 Updated flow-bin from 91 -> 93 and removed unnecessary fixmes 2019-02-21 09:15:47 -08:00
Brian Vaughn
e35819e68d Renamed nativeHookIndex -> index 2019-02-21 08:59:46 -08:00
Brian Vaughn
532cca8013 Merge pull request #4 from mishaor/linux-support
Added support for Linux
2019-02-21 08:24:33 -08:00
Michael Orishich
b0ccd9d89e added basic support for Linux 2019-02-21 20:00:11 +02:00
Brian Vaughn
8cd8b29015 Added support for editable hook values (pending facebook/react/pull/14906) 2019-02-20 15:58:52 -08:00
Brian Vaughn
90f98372a9 Fixed broken 'shutdown' event that lead to CPU problems when reloading DevTools 2019-02-20 11:55:48 -08:00
Brian Vaughn
42795b22bf Installed eslint-plugin-react-hooks@next and added to ESLint config 2019-02-20 11:03:50 -08:00
Brian Vaughn
bec073365d Fix hooks warnings identified by prerelease version of react-hooks ESLint plugin 2019-02-19 13:15:57 -08:00
Brian Vaughn
a31415011d Removed numeric key code 2019-02-19 08:59:27 -08:00
Brian Vaughn
3376daaa41 Merge pull request #2 from Jessidhia/fix-utf-encoding
Fix encoding of Unicode keys greater than U+00FF
2019-02-19 08:56:21 -08:00
Jessica
044e6ba9cd Pass options to scrollIntoView 2019-02-19 16:36:43 +09:00
Jessica
65d493cae9 Just use codepoints as it'll be copied into an Uint32Array anyway 2019-02-19 16:03:53 +09:00
Jessica
4ee74f7e6c Fix encoding of Unicode keys greater than U+00FF (greater than U+FFFF handled by surrogate pairs) 2019-02-19 15:52:24 +09:00
Jessica
28ea0a352e Scroll to newly selected component if it's out of view 2019-02-19 12:22:19 +09:00
Brian Vaughn
a4212dcdce Support editable props, state, and context values 2019-02-17 13:07:39 -08:00
Brian Vaughn
6c226b0c80 Added link to now.sh preview to README 2019-02-16 09:46:10 -08:00
Brian Vaughn
c4d6fdbfdb Fixed overlay position bug 2019-02-16 08:33:38 -08:00
Brian Vaughn
1d95098177 Implemented select-DOM-element button 2019-02-16 08:29:26 -08:00
Brian Vaughn
2fbacbff01 Tab bar resizes properly for narrow screens 2019-02-15 11:42:55 -08:00
Brian Vaughn
0008bb00d7 Inspectable complex hook values 2019-02-14 21:55:09 -08:00
Brian Vaughn
47a5fd59cb Reduced tree padding (left) slightly to make larger trees easier to inspect 2019-02-14 15:13:43 -08:00
Brian Vaughn
04a0d24f0f Fixed a potential source of duplicate key 2019-02-14 15:06:38 -08:00
Brian Vaughn
3f40d38203 Fixed edge case mutation bugs in selected element and tree context 2019-02-14 14:36:29 -08:00
Brian Vaughn
bf2f13d32a Removed some stale TODO comments 2019-02-14 13:37:40 -08:00
Brian Vaughn
9cfa25bdcc Tidied up Flow types for Bridge and Store 2019-02-14 13:32:30 -08:00
Brian Vaughn
b167dd339b Style, theme, and button CSS cleanup 2019-02-14 13:20:24 -08:00
Brian Vaughn
a07d9862ca Fixed edge-case display density bug 2019-02-14 12:46:27 -08:00
Brian Vaughn
15c5396169 Re-added "Settings" panel to browser extension and (hopefully) fixed a lot of sources of error 2019-02-14 11:45:11 -08:00
Brian Vaughn
5a301cd26e Tweaked the owner stack exit icon 2019-02-14 09:23:54 -08:00
Brian Vaughn
36e596ecd1 Changed dark theme to have more React blues 2019-02-14 09:17:29 -08:00
Brian Vaughn
94aab74253 Avoid NPE in Agent if renderer can't be found for an ID 2019-02-14 08:13:35 -08:00
Brian Vaughn
c229837f33 Temporarily disabled Settings panel 2019-02-13 11:36:43 -08:00
Brian Vaughn
79f57532b9 Split demo app into multiple roots and fixed a multi-root bug 2019-02-13 11:22:22 -08:00
Brian Vaughn
4ea81337f3 Initial pass at adding Settings panel to browser extension 2019-02-13 10:59:49 -05:00
Brian Vaughn
aed1713154 Added NOW config file for dev shell 2019-02-12 21:09:50 -05:00
Brian Vaughn
95b859209f Fixed NaN warning for pre-mount CSS prop read 2019-02-12 21:09:33 -05:00
Brian Vaughn
d203ebf165 Added new tabs UI and theme/display-density preferences 2019-02-12 20:41:39 -05:00
Brian Vaughn
8e5a35b762 Misc cleanup and prep for dark mode CSS 2019-02-12 09:45:00 -05:00
Brian Vaughn
f3f497f40f Cleaned up CSS vars and reduced font size a bit 2019-02-08 20:27:10 -05:00
Brian Vaughn
a6126c9e27 Initial stab at 'View in DOM' button 2019-02-08 18:48:29 -05:00
Brian Vaughn
baa6142801 Removed non-functioning tree arrows (for now) 2019-02-08 16:16:15 -05:00
Brian Vaughn
c6b0338f13 Reverted immutable element change (for now) 2019-02-08 16:05:48 -05:00
Brian Vaughn
872d0f78d4 Tweaked owners breadcrumb style to batter match tree colors 2019-02-08 15:49:52 -05:00
Brian Vaughn
41514d67f0 Small refinements to Store: read-only Elements in map, added revision to guard against tearing 2019-02-08 15:37:52 -05:00
Brian Vaughn
0380186501 Refactored tree, search, selection, and owners contexts 2019-02-08 14:44:07 -05:00
Brian Vaughn
45641e98e5 Added owner tree exploration view 2019-02-07 14:34:24 +00:00
Brian Vaughn
fc924d136a Combined search and selection contexts to avoid complicated dependencies 2019-02-07 09:29:42 +00:00
Brian Vaughn
9c093ac731 Fixed regexp parsing 2019-02-06 21:33:44 +00:00
Brian Vaughn
c61e0f0d54 Added a clarifying comment to SearchInput 2019-02-06 17:09:46 +00:00
Brian Vaughn
e77ba00336 Replaced SearchContext useStates with useReducer and fixed an edge-case search bug 2019-02-06 16:31:02 +00:00
Brian Vaughn
998e69a10d Added search support 2019-02-05 17:14:06 +00:00
Brian Vaughn
e723ec82bc Added $r support 2019-02-05 13:19:08 +00:00
Brian Vaughn
ce7f060e26 Cleaned up property borders 2019-02-05 11:26:37 +00:00
Brian Vaughn
6dc3fa6fbd Cleaned up style vars 2019-02-05 11:23:37 +00:00
Brian Vaughn
1566141177 Strip React elements from serialized data (and display <name/> instead 2019-02-05 10:25:33 +00:00
Brian Vaughn
33deb79ce4 Added simple hooks support (same as in legacy DevTools for now)
I had to add a couple of  comments because Flow was being a mysterious little shit and I got tired of trying to work around it.
2019-02-05 09:23:14 +00:00
Brian Vaughn
d0d5b677de Added better context support 2019-02-05 08:32:02 +00:00
Brian Vaughn
6f952ede2f Fixed regression in browser shell 2019-02-04 18:01:44 +00:00
Brian Vaughn
b56bc1a626 Initial pass at properties panel. Lots of TODOs remaining. 2019-02-04 17:49:30 +00:00
Brian Vaughn
406df2a617 Added properties panel and selected element context 2019-02-02 13:57:32 -08:00
Brian Vaughn
9aa6e13d5f Tidied up devtools frontend a little 2019-02-01 09:25:54 -08:00
Brian Vaughn
ad74c54670 Adding tearing warning to Store 2019-01-31 15:59:08 -08:00
Brian Vaughn
1866aef67c Fixed small CSS bug 2019-01-31 15:48:47 -08:00
Brian Vaughn
1eccdd6f8a Moved search icon into separate React component 2019-01-31 14:46:18 -08:00
Brian Vaughn
89f4955b93 Don't show roots in Elements tree 2019-01-31 14:31:12 -08:00
Brian Vaughn
bdfaeede6d Fixed potential race cases in bridge/store/backend initialization 2019-01-31 14:27:16 -08:00
Brian Vaughn
62f8c985df Added stub search row (not connected to anythign yet) 2019-01-31 09:42:07 -08:00
Brian Vaughn
6363fc0767 Tweaked error message to provide more helpful info if shown 2019-01-30 14:39:37 -08:00
Brian Vaughn
ca6151ca01 Reload extension on navigate 2019-01-30 14:16:55 -08:00
Brian Vaughn
6d37857df3 Fixed an Array type bug in Store 2019-01-30 11:31:13 -08:00
Brian Vaughn
a60c8e139a Renamed app.js to App.js for consistency 2019-01-30 10:49:50 -08:00
Brian Vaughn
037071c0e1 Remove root from "roots" list on unmount 2019-01-30 10:41:53 -08:00
Brian Vaughn
1f46df66cb Tidying up 2019-01-30 10:38:52 -08:00
Brian Vaughn
f542f879d6 Added inline comments for types 2019-01-29 14:04:00 -08:00
Brian Vaughn
fc4af4d018 Fixed text wrap bug in extension panel 2019-01-29 13:48:35 -08:00
Brian Vaughn
fdfadef928 Refactored bridge to support transferrables (e.g. typed array buffers) and added transferable param to postMessage for op codes 2019-01-29 13:17:37 -08:00
Brian Vaughn
3f93b029a4 Replaced node objects with typed array of tree operations; windowing works in small test harness 2019-01-28 15:50:48 -08:00
Brian Vaughn
c9a5f8cc29 Stashing partial windowing implementation 2019-01-27 16:04:17 -08:00
Brian Vaughn
b7cbd38214 Misc updates to better handle tearing and add some future TODOs 2019-01-27 07:58:09 -08:00
Brian Vaughn
13ca26e153 Removed throttling. It's too error prone because of mutations (Fibers). We'll optimize later by using the effects list for updates. 2019-01-24 13:45:29 -08:00
Brian Vaughn
d57ec69561 Added initial Chrome/Firefox shells 2019-01-23 18:06:21 -08:00
Brian Vaughn
f881c32304 Added Prettier (and formatted code) 2019-01-23 08:45:19 -08:00
Brian Vaughn
d02b4a2784 Throttle bridge traffic for Elements tree updates 2019-01-23 08:27:40 -08:00
Brian Vaughn
7b9a8e9843 Added a super basic README 2019-01-22 11:07:56 -08:00
Brian Vaughn
5e0dfdac54 Initial commit 2019-01-22 11:04:37 -08:00
1455 changed files with 199648 additions and 43046 deletions

View File

@@ -11,9 +11,9 @@ aliases:
restore_cache:
name: Restore node_modules cache
keys:
- v1-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}
- v1-node-{{ arch }}-{{ .Branch }}-
- v1-node-{{ arch }}-
- v2-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}
- v2-node-{{ arch }}-{{ .Branch }}-
- v2-node-{{ arch }}-
- &run_yarn
run:
name: Install Packages
@@ -22,6 +22,31 @@ aliases:
- &attach_workspace
at: build
- &process_artifacts
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
- run: node ./scripts/rollup/consolidateBundleSizes.js
- run: ./scripts/circleci/pack_and_store_artifact.sh
- store_artifacts:
path: ./node_modules.tgz
- store_artifacts:
path: ./build.tgz
- store_artifacts:
path: ./build/bundle-sizes.json
- store_artifacts:
# TODO: Update release script to use local file instead of pulling
# from artifacts.
path: ./scripts/error-codes/codes.json
- persist_to_workspace:
root: build
paths:
- bundle-sizes.json
jobs:
setup:
docker: *docker
@@ -36,11 +61,11 @@ jobs:
- *run_yarn
- save_cache:
name: Save node_modules cache
key: v1-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}
key: v2-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
lint:
yarn_lint:
docker: *docker
environment: *environment
@@ -54,7 +79,7 @@ jobs:
- run: ./scripts/circleci/check_modules.sh
- run: ./scripts/circleci/test_print_warnings.sh
flow:
yarn_flow:
docker: *docker
environment: *environment
@@ -64,7 +89,7 @@ jobs:
- *run_yarn
- run: node ./scripts/tasks/flow-ci
test_source:
RELEASE_CHANNEL_stable_yarn_test:
docker: *docker
environment: *environment
@@ -72,9 +97,90 @@ jobs:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --maxWorkers=2
- run: yarn test --release-channel=stable --ci
test_source_persistent:
yarn_test:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --ci
RELEASE_CHANNEL_stable_yarn_test_www:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=www-classic --ci
RELEASE_CHANNEL_stable_yarn_test_www_variant:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=www-classic --variant --ci
RELEASE_CHANNEL_stable_yarn_test_prod_www:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=www-classic --prod --ci
RELEASE_CHANNEL_stable_yarn_test_prod_www_variant:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=www-classic --prod --variant --ci
yarn_test_www:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=www-modern --ci
yarn_test_www_variant:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=www-modern --variant --ci
yarn_test_prod_www:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=www-modern --prod --ci
yarn_test_prod_www_variant:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=www-modern --prod --variant --ci
RELEASE_CHANNEL_stable_yarn_test_persistent:
docker: *docker
environment: *environment
@@ -82,9 +188,9 @@ jobs:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test-persistent --maxWorkers=2
- run: yarn test --release-channel=stable --persistent --ci
test_source_prod:
RELEASE_CHANNEL_stable_yarn_test_prod:
docker: *docker
environment: *environment
@@ -92,9 +198,18 @@ jobs:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test-prod --maxWorkers=2
- run: yarn test --release-channel=stable --prod --ci
build:
yarn_test_prod:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=experimental --prod --ci
RELEASE_CHANNEL_stable_yarn_build:
docker: *docker
environment: *environment
parallelism: 20
@@ -102,19 +217,74 @@ jobs:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: ./scripts/circleci/add_build_info_json.sh
- run: ./scripts/circleci/update_package_versions.sh
- run: yarn build
- run:
environment:
RELEASE_CHANNEL: stable
command: |
./scripts/circleci/add_build_info_json.sh
./scripts/circleci/update_package_versions.sh
yarn build
- run: echo "stable" >> build/RELEASE_CHANNEL
- persist_to_workspace:
root: build
paths:
- RELEASE_CHANNEL
- facebook-www
- facebook-react-native
- node_modules
- react-native
- dist
- sizes/*.json
process_artifacts:
yarn_build:
docker: *docker
environment: *environment
parallelism: 20
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run:
environment:
RELEASE_CHANNEL: experimental
command: |
./scripts/circleci/add_build_info_json.sh
./scripts/circleci/update_package_versions.sh
yarn build
- run: echo "experimental" >> build/RELEASE_CHANNEL
- persist_to_workspace:
root: build
paths:
- RELEASE_CHANNEL
- facebook-www
- facebook-react-native
- node_modules
- react-native
- dist
- sizes/*.json
build_devtools_and_process_artifacts:
docker: *docker
environment: *environment
parallelism: 20
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
- run:
environment:
RELEASE_CHANNEL: experimental
command: ./scripts/circleci/pack_and_store_devtools_artifacts.sh
- store_artifacts:
path: ./build/devtools.tgz
# These jobs are named differently so we can distinguish the stable and
# and experimental artifacts
process_artifacts: *process_artifacts
process_artifacts_experimental: *process_artifacts
sizebot_stable:
docker: *docker
environment: *environment
steps:
@@ -122,22 +292,31 @@ jobs:
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
# This runs in the process_artifacts job, too, but it's faster to run
# this step in both jobs instead of running the jobs sequentially
- run: node ./scripts/rollup/consolidateBundleSizes.js
- run: node ./scripts/tasks/danger
- run: ./scripts/circleci/upload_build.sh
- run: ./scripts/circleci/pack_and_store_artifact.sh
- store_artifacts:
path: ./node_modules.tgz
- store_artifacts:
path: ./build.tgz
- store_artifacts:
path: ./build/bundle-sizes.json
- store_artifacts:
# TODO: Update release script to use local file instead of pulling
# from artifacts.
path: ./scripts/error-codes/codes.json
- run:
environment:
RELEASE_CHANNEL: stable
command: node ./scripts/tasks/danger
lint_build:
sizebot_experimental:
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
# This runs in the process_artifacts job, too, but it's faster to run
# this step in both jobs instead of running the jobs sequentially
- run: node ./scripts/rollup/consolidateBundleSizes.js
- run:
environment:
RELEASE_CHANNEL: experimental
command: node ./scripts/tasks/danger
yarn_lint_build:
docker: *docker
environment: *environment
steps:
@@ -148,7 +327,7 @@ jobs:
- run: yarn lint-build
- run: scripts/circleci/check_minified_errors.sh
test_build:
RELEASE_CHANNEL_stable_yarn_lint_build:
docker: *docker
environment: *environment
steps:
@@ -156,9 +335,43 @@ jobs:
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
- run: yarn test-build --maxWorkers=2
- run:
environment:
RELEASE_CHANNEL: stable
command: yarn lint-build
- run: scripts/circleci/check_minified_errors.sh
test_dom_fixtures:
RELEASE_CHANNEL_stable_yarn_test_build:
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=stable --build --ci
yarn_test_build:
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=experimental --build --ci
yarn_test_build_devtools:
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
- run: yarn test --project=devtools --build --ci
RELEASE_CHANNEL_stable_yarn_test_dom_fixtures:
docker: *docker
environment: *environment
steps:
@@ -167,6 +380,8 @@ jobs:
- *restore_yarn_cache
- run:
name: Run DOM fixture tests
environment:
RELEASE_CHANNEL: stable
command: |
cd fixtures/dom
yarn --frozen-lockfile
@@ -183,10 +398,10 @@ jobs:
- run:
name: Run fuzz tests
command: |
FUZZ_TEST_SEED=$RANDOM yarn test fuzz --maxWorkers=2
FUZZ_TEST_SEED=$RANDOM yarn test-prod fuzz --maxWorkers=2
FUZZ_TEST_SEED=$RANDOM yarn test fuzz --ci
FUZZ_TEST_SEED=$RANDOM yarn test --prod fuzz --ci
test_build_prod:
RELEASE_CHANNEL_stable_yarn_test_build_prod:
docker: *docker
environment: *environment
steps:
@@ -194,49 +409,123 @@ jobs:
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
- run: yarn test-build-prod --maxWorkers=2
- run: yarn test --release-channel=stable --build --prod --ci
yarn_test_build_prod:
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=experimental --build --prod --ci
workflows:
version: 2
commit:
stable:
jobs:
- setup
- lint:
- yarn_lint:
requires:
- setup
- flow:
- yarn_flow:
requires:
- setup
- test_source:
- RELEASE_CHANNEL_stable_yarn_test:
requires:
- setup
- test_source_prod:
- RELEASE_CHANNEL_stable_yarn_test_prod:
requires:
- setup
- test_source_persistent:
- RELEASE_CHANNEL_stable_yarn_test_persistent:
requires:
- setup
- build:
- RELEASE_CHANNEL_stable_yarn_test_www:
requires:
- setup
- RELEASE_CHANNEL_stable_yarn_test_www_variant:
requires:
- setup
- RELEASE_CHANNEL_stable_yarn_test_prod_www:
requires:
- setup
- RELEASE_CHANNEL_stable_yarn_test_prod_www_variant:
requires:
- setup
- RELEASE_CHANNEL_stable_yarn_build:
requires:
- setup
- process_artifacts:
requires:
- build
- lint_build:
- RELEASE_CHANNEL_stable_yarn_build
- sizebot_stable:
requires:
- build
- test_build:
- RELEASE_CHANNEL_stable_yarn_build
- RELEASE_CHANNEL_stable_yarn_lint_build:
requires:
- build
- test_build_prod:
- RELEASE_CHANNEL_stable_yarn_build
- RELEASE_CHANNEL_stable_yarn_test_build:
requires:
- build
- test_dom_fixtures:
- RELEASE_CHANNEL_stable_yarn_build
- RELEASE_CHANNEL_stable_yarn_test_build_prod:
requires:
- build
hourly:
- RELEASE_CHANNEL_stable_yarn_build
- RELEASE_CHANNEL_stable_yarn_test_dom_fixtures:
requires:
- RELEASE_CHANNEL_stable_yarn_build
experimental:
jobs:
- setup
- yarn_test:
requires:
- setup
- yarn_test_prod:
requires:
- setup
- yarn_test_www:
requires:
- setup
- yarn_test_www_variant:
requires:
- setup
- yarn_test_prod_www:
requires:
- setup
- yarn_test_prod_www_variant:
requires:
- setup
- yarn_build:
requires:
- setup
- process_artifacts_experimental:
requires:
- yarn_build
- sizebot_experimental:
requires:
- yarn_build
- yarn_test_build:
requires:
- yarn_build
- yarn_test_build_prod:
requires:
- yarn_build
- yarn_lint_build:
requires:
- yarn_build
- yarn_test_build_devtools:
requires:
- yarn_build
# FIXME: Temporarily disabled to unblock master.
# - build_devtools_and_process_artifacts:
# requires:
# - yarn_build
fuzz_tests:
triggers:
- schedule:
# Fuzz tests run hourly
cron: "0 * * * *"
filters:
branches:

10
.codesandbox/ci.json Normal file
View File

@@ -0,0 +1,10 @@
{
"packages": ["packages/react", "packages/react-dom", "packages/scheduler"],
"buildCommand": "build --type=NODE react/index,react-dom/index,react-dom/server,scheduler/index,scheduler/tracing",
"publishDirectory": {
"react": "build/node_modules/react",
"react-dom": "build/node_modules/react-dom",
"scheduler": "build/node_modules/scheduler"
},
"sandboxes": ["new"]
}

View File

@@ -1,4 +1,4 @@
# http://editorconfig.org
# https://editorconfig.org
root = true
[*]

View File

@@ -12,3 +12,10 @@ scripts/bench/benchmarks/**/*.js
# React repository clone
scripts/bench/remote-repo/
packages/react-devtools-core/dist
packages/react-devtools-extensions/chrome/build
packages/react-devtools-extensions/firefox/build
packages/react-devtools-extensions/shared/build
packages/react-devtools-inline/dist
packages/react-devtools-shell/dist

View File

@@ -5,11 +5,13 @@ const {
esNextPaths,
} = require('./scripts/shared/pathsByLanguageVersion');
const restrictedGlobals = require('confusing-browser-globals');
const OFF = 0;
const ERROR = 2;
module.exports = {
extends: 'fbjs',
extends: ['fbjs', 'prettier'],
// Stop ESLint from looking for a configuration file in parent folders
root: true,
@@ -30,10 +32,10 @@ module.exports = {
rules: {
'accessor-pairs': OFF,
'brace-style': [ERROR, '1tbs'],
'comma-dangle': [ERROR, 'always-multiline'],
'consistent-return': OFF,
'dot-location': [ERROR, 'property'],
'dot-notation': ERROR,
// We use console['error']() as a signal to not transform it:
'dot-notation': [ERROR, {allowPattern: '^(error|warn)$'}],
'eol-last': ERROR,
eqeqeq: [ERROR, 'allow-null'],
indent: OFF,
@@ -42,6 +44,7 @@ module.exports = {
'no-bitwise': OFF,
'no-inner-declarations': [ERROR, 'functions'],
'no-multi-spaces': ERROR,
'no-restricted-globals': [ERROR].concat(restrictedGlobals),
'no-restricted-syntax': [ERROR, 'WithStatement'],
'no-shadow': ERROR,
'no-unused-expressions': ERROR,
@@ -92,7 +95,10 @@ module.exports = {
// the second argument of warning/invariant should be a literal string
'react-internal/no-primitive-constructors': ERROR,
'react-internal/no-to-warn-dev-within-to-throw': ERROR,
'react-internal/warning-and-invariant-args': ERROR,
'react-internal/invariant-args': ERROR,
'react-internal/warning-args': ERROR,
'react-internal/no-production-logging': ERROR,
'react-internal/no-cross-fork-imports': ERROR,
},
overrides: [
@@ -121,6 +127,7 @@ module.exports = {
},
rules: {
'no-var': ERROR,
'prefer-const': ERROR,
strict: OFF,
},
},
@@ -133,19 +140,45 @@ module.exports = {
'jest/valid-expect-in-promise': ERROR,
},
},
{
files: [
'**/__tests__/**/*.js',
'scripts/**/*.js',
'packages/*/npm/**/*.js',
'packages/dom-event-testing-library/**/*.js',
'packages/react-devtools*/**/*.js',
],
rules: {
'react-internal/no-production-logging': OFF,
'react-internal/warning-args': OFF,
},
},
{
files: ['packages/react-native-renderer/**/*.js'],
globals: {
nativeFabricUIManager: true,
},
},
{
files: ['packages/react-transport-dom-webpack/**/*.js'],
globals: {
__webpack_chunk_load__: true,
__webpack_require__: true,
},
},
],
globals: {
SharedArrayBuffer: true,
spyOnDev: true,
spyOnDevAndProd: true,
spyOnProd: true,
__PROFILE__: true,
__UMD__: true,
__EXPERIMENTAL__: true,
__VARIANT__: true,
gate: true,
trustedTypes: true,
},
};

View File

@@ -1,14 +0,0 @@
<!--
Note: if the issue is about documentation or the website, please file it at:
https://github.com/reactjs/reactjs.org/issues/new
-->
**Do you want to request a *feature* or report a *bug*?**
**What is the current behavior?**
**If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:**
**What is the expected behavior?**
**Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?**

41
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,41 @@
---
name: "🐛 Bug Report"
about: Report a reproducible bug or regression.
title: 'Bug: '
labels: 'Status: Unconfirmed'
---
<!--
Please provide a clear and concise description of what the bug is. Include
screenshots if needed. Please test using the latest version of the relevant
React packages to make sure your issue has not already been fixed.
-->
React version:
## Steps To Reproduce
1.
2.
<!--
Your bug will get fixed much faster if we can run your code and it doesn't
have dependencies other than React. Issues without reproduction steps or
code examples may be immediately closed as not actionable.
-->
Link to code example:
<!--
Please provide a CodeSandbox (https://codesandbox.io/s/new), a link to a
repository on GitHub, or provide a minimal code example that reproduces the
problem. You may provide a screenshot of the application if you think it is
relevant to your bug report. Here are some tips for providing a minimal
example: https://stackoverflow.com/help/mcve.
-->
## The current behavior
## The expected behavior

7
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,7 @@
contact_links:
- name: 📃 Documentation Issue
url: https://github.com/reactjs/reactjs.org/issues/new
about: This issue tracker is not for documentation issues. Please file documentation issues here.
- name: 🤔 Questions and Help
url: https://reactjs.org/community/support.html
about: This issue tracker is not for support questions. Please refer to the React community's help and discussion forums.

View File

@@ -1,14 +1,27 @@
**Before submitting a pull request,** please make sure the following is done:
<!--
Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The three fields below are mandatory.
1. Fork [the repository](https://github.com/facebook/react) and create your branch from `master`.
2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch TestName` is helpful in development.
5. Run `yarn test-prod` to test in the production environment. It supports the same options as `yarn test`.
6. If you need a debugger, run `yarn debug-test --watch TestName`, open `chrome://inspect`, and press "Inspect".
7. Format your code with [prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only check changed files.
9. Run the [Flow](https://flowtype.org/) typechecks (`yarn flow`).
10. If you haven't already, complete the CLA.
Before submitting a pull request, please make sure the following is done:
**Learn more about contributing:** https://reactjs.org/docs/how-to-contribute.html
1. Fork [the repository](https://github.com/facebook/react) and create your branch from `master`.
2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch TestName` is helpful in development.
5. Run `yarn test-prod` to test in the production environment. It supports the same options as `yarn test`.
6. If you need a debugger, run `yarn debug-test --watch TestName`, open `chrome://inspect`, and press "Inspect".
7. Format your code with [prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only check changed files.
9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
10. If you haven't already, complete the CLA.
Learn more about contributing: https://reactjs.org/docs/how-to-contribute.html
-->
## Summary
<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->
## Test Plan
<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes the user interface. -->

34
.github/stale.yml vendored Normal file
View File

@@ -0,0 +1,34 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 90
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- "Partner"
- "React Core Team"
- "Resolution: Backlog"
- "Type: Bug"
- "Type: Discussion"
- "Type: Needs Investigation"
- "Type: Regression"
# Label to use when marking an issue as stale
staleLabel: "Resolution: Stale"
issues:
# Comment to post when marking an issue as stale.
markComment: >
This issue has been automatically marked as stale.
**If this issue is still affecting you, please leave any comment** (for example, "bump"), and we'll keep it open.
We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
# Comment to post when closing a stale issue.
closeComment: >
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!
pulls:
# Comment to post when marking a pull request as stale.
markComment: >
This pull request has been automatically marked as stale.
**If this pull request is still relevant, please leave any comment** (for example, "bump"), and we'll keep it open.
We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.
# Comment to post when closing a stale pull request.
closeComment: >
Closing this pull request after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you!

13
.gitignore vendored
View File

@@ -1,6 +1,7 @@
.DS_STORE
node_modules
scripts/flow/*/.flowconfig
.flowconfig
*~
*.pyc
.grunt
@@ -22,3 +23,15 @@ chrome-user-data
.vscode
*.swp
*.swo
packages/react-devtools-core/dist
packages/react-devtools-extensions/chrome/build
packages/react-devtools-extensions/chrome/*.crx
packages/react-devtools-extensions/chrome/*.pem
packages/react-devtools-extensions/firefox/build
packages/react-devtools-extensions/firefox/*.xpi
packages/react-devtools-extensions/firefox/*.pem
packages/react-devtools-extensions/shared/build
packages/react-devtools-extensions/.tempUserDataDir
packages/react-devtools-inline/dist
packages/react-devtools-shell/dist

View File

@@ -88,6 +88,7 @@ Kevin Coughlin <kevintcoughlin@gmail.com> <kevincoughlin@tumblr.com>
Krystian Karczewski <karcz.k@gmail.com>
Kunal Mehta <k.mehta@berkeley.edu> <kunalm@fb.com>
Laurence Rowe <l@lrowe.co.uk> <laurence@lrowe.co.uk>
Lea Rosema <terabaud@gmail.com>
Marcin K. <katzoo@github.mail>
Mark Anderson <undernewmanagement@users.noreply.github.com>
Mark Funk <mfunk86@gmail.com> <mark@boomtownroi.com>

2
.nvmrc
View File

@@ -1 +1 @@
v8.4.0
v12.16.2

6
.prettierignore Normal file
View File

@@ -0,0 +1,6 @@
packages/react-devtools-core/dist
packages/react-devtools-extensions/chrome/build
packages/react-devtools-extensions/firefox/build
packages/react-devtools-extensions/shared/build
packages/react-devtools-inline/dist
packages/react-devtools-shell/dist

View File

@@ -8,7 +8,7 @@ module.exports = {
jsxBracketSameLine: true,
trailingComma: 'es5',
printWidth: 80,
parser: 'babylon',
parser: 'babel',
overrides: [
{

View File

@@ -1,10 +1,89 @@
## [Unreleased]
<details>
<summary>
Changes that have landed in master but are not yet released.
Click to see more.
</summary>
</details>
## 16.13.1 (March 19, 2020)
### React DOM
* Fix bug in legacy mode Suspense where effect clean-up functions are not fired. This only affects users who use Suspense for data fetching in legacy mode, which is not technically supported. ([@acdlite](https://github.com/acdlite) in [#18238](https://github.com/facebook/react/pull/18238))
* Revert warning for cross-component updates that happen inside class render lifecycles (`componentWillReceiveProps`, `shouldComponentUpdate`, and so on). ([@gaearon](https://github.com/gaearon) in [#18330](https://github.com/facebook/react/pull/18330))
## 16.13.0 (February 26, 2020)
### React
* Warn when a string ref is used in a manner that's not amenable to a future codemod ([@lunaruan](https://github.com/lunaruan) in [#17864](https://github.com/facebook/react/pull/17864))
* Deprecate `React.createFactory()` ([@trueadm](https://github.com/trueadm) in [#17878](https://github.com/facebook/react/pull/17878))
### React DOM
* Warn when changes in `style` may cause an unexpected collision ([@sophiebits](https://github.com/sophiebits) in [#14181](https://github.com/facebook/react/pull/14181), [#18002](https://github.com/facebook/react/pull/18002))
* Warn when a function component is updated during another component's render phase ([@acdlite](https://github.com/acdlite) in [#17099](https://github.com/facebook/react/pull/17099))
* Deprecate `unstable_createPortal` ([@trueadm](https://github.com/trueadm) in [#17880](https://github.com/facebook/react/pull/17880))
* Fix `onMouseEnter` being fired on disabled buttons ([@AlfredoGJ](https://github.com/AlfredoGJ) in [#17675](https://github.com/facebook/react/pull/17675))
* Call `shouldComponentUpdate` twice when developing in `StrictMode` ([@bvaughn](https://github.com/bvaughn) in [#17942](https://github.com/facebook/react/pull/17942))
* Add `version` property to ReactDOM ([@ealush](https://github.com/ealush) in [#15780](https://github.com/facebook/react/pull/15780))
* Don't call `toString()` of `dangerouslySetInnerHTML` ([@sebmarkbage](https://github.com/sebmarkbage) in [#17773](https://github.com/facebook/react/pull/17773))
* Show component stacks in more warnings ([@gaearon](https://github.com/gaearon) in [#17922](https://github.com/facebook/react/pull/17922), [#17586](https://github.com/facebook/react/pull/17586))
### Concurrent Mode (Experimental)
* Warn for problematic usages of `ReactDOM.createRoot()` ([@trueadm](https://github.com/trueadm) in [#17937](https://github.com/facebook/react/pull/17937))
* Remove `ReactDOM.createRoot()` callback params and added warnings on usage ([@bvaughn](https://github.com/bvaughn) in [#17916](https://github.com/facebook/react/pull/17916))
* Don't group Idle/Offscreen work with other work ([@sebmarkbage](https://github.com/sebmarkbage) in [#17456](https://github.com/facebook/react/pull/17456))
* Adjust `SuspenseList` CPU bound heuristic ([@sebmarkbage](https://github.com/sebmarkbage) in [#17455](https://github.com/facebook/react/pull/17455))
* Add missing event plugin priorities ([@trueadm](https://github.com/trueadm) in [#17914](https://github.com/facebook/react/pull/17914))
* Fix `isPending` only being true when transitioning from inside an input event ([@acdlite](https://github.com/acdlite) in [#17382](https://github.com/facebook/react/pull/17382))
* Fix `React.memo` components dropping updates when interrupted by a higher priority update ([@acdlite]((https://github.com/acdlite)) in [#18091](https://github.com/facebook/react/pull/18091))
* Don't warn when suspending at the wrong priority ([@gaearon](https://github.com/gaearon) in [#17971](https://github.com/facebook/react/pull/17971))
* Fix a bug with rebasing updates ([@acdlite](https://github.com/acdlite) and [@sebmarkbage](https://github.com/sebmarkbage) in [#17560](https://github.com/facebook/react/pull/17560), [#17510](https://github.com/facebook/react/pull/17510), [#17483](https://github.com/facebook/react/pull/17483), [#17480](https://github.com/facebook/react/pull/17480))
## 16.12.0 (November 14, 2019)
### React DOM
* Fix passive effects (`useEffect`) not being fired in a multi-root app. ([@acdlite](https://github.com/acdlite) in [#17347](https://github.com/facebook/react/pull/17347))
### React Is
* Fix `lazy` and `memo` types considered elements instead of components ([@bvaughn](https://github.com/bvaughn) in [#17278](https://github.com/facebook/react/pull/17278))
## 16.11.0 (October 22, 2019)
### React DOM
* Fix `mouseenter` handlers from firing twice inside nested React containers. [@yuanoook](https://github.com/yuanoook) in [#16928](https://github.com/facebook/react/pull/16928)
* Remove `unstable_createRoot` and `unstable_createSyncRoot` experimental APIs. (These are available in the Experimental channel as `createRoot` and `createSyncRoot`.) ([@acdlite](http://github.com/acdlite) in [#17088](https://github.com/facebook/react/pull/17088))
## 16.10.2 (October 3, 2019)
### React DOM
* Fix regression in react-native-web by restoring order of arguments in event plugin extractors ([@necolas](https://github.com/necolas) in [#16978](https://github.com/facebook/react/pull/16978))
## 16.10.1 (September 28, 2019)
### React DOM
* Fix regression in Next.js apps by allowing Suspense mismatch during hydration to silently proceed ([@sebmarkbage](https://github.com/sebmarkbage) in [#16943](https://github.com/facebook/react/pull/16943))
## 16.10.0 (September 27, 2019)
### React DOM
* Fix edge case where a hook update wasn't being memoized. ([@sebmarkbage](http://github.com/sebmarkbage) in [#16359](https://github.com/facebook/react/pull/16359))
* Fix heuristic for determining when to hydrate, so we don't incorrectly hydrate during an update. ([@sebmarkbage](http://github.com/sebmarkbage) in [#16739](https://github.com/facebook/react/pull/16739))
* Clear additional fiber fields during unmount to save memory. ([@trueadm](http://github.com/trueadm) in [#16807](https://github.com/facebook/react/pull/16807))
* Fix bug with required text fields in Firefox. ([@halvves](http://github.com/halvves) in [#16578](https://github.com/facebook/react/pull/16578))
* Prefer `Object.is` instead of inline polyfill, when available. ([@ku8ar](http://github.com/ku8ar) in [#16212](https://github.com/facebook/react/pull/16212))
* Fix bug when mixing Suspense and error handling. ([@acdlite](http://github.com/acdlite) in [#16801](https://github.com/facebook/react/pull/16801))
### Scheduler (Experimental)
* Improve queue performance by switching its internal data structure to a min binary heap. ([@acdlite](http://github.com/acdlite) in [#16245](https://github.com/facebook/react/pull/16245))
* Use `postMessage` loop with short intervals instead of attempting to align to frame boundaries with `requestAnimationFrame`. ([@acdlite](http://github.com/acdlite) in [#16214](https://github.com/facebook/react/pull/16214))
### useSubscription
* Avoid tearing issue when a mutation happens and the previous update is still in progress. ([@bvaughn](http://github.com/bvaughn) in [#16623](https://github.com/facebook/react/pull/16623))
## 16.9.0 (August 8, 2019)
@@ -41,6 +120,10 @@
* Warn in Strict Mode if effects are scheduled outside an `act()` call. ([@threepointone](https://github.com/threepointone) in [#15763](https://github.com/facebook/react/pull/15763) and [#16041](https://github.com/facebook/react/pull/16041))
* Warn when using `act` from the wrong renderer. ([@threepointone](https://github.com/threepointone) in [#15756](https://github.com/facebook/react/pull/15756))
### ESLint Plugin: React Hooks
* Report Hook calls at the top level as a violation. ([gaearon](https://github.com/gaearon) in [#16455](https://github.com/facebook/react/pull/16455))
## 16.8.6 (March 27, 2019)
### React DOM
@@ -480,7 +563,7 @@ This release was published in a broken state and should be skipped.
* Fix an issue with `this.state` of different components getting mixed up. ([@sophiebits](https://github.com/sophiebits) in [#12323](https://github.com/facebook/react/pull/12323))
* Provide a better message when component type is undefined. ([@HeroProtagonist](https://github.com/HeroProtagonist) in [#11966](https://github.com/facebook/react/pull/11966))
## React Test Renderer
### React Test Renderer
* Fix handling of fragments in `toTree()`. ([@maciej-ka](https://github.com/maciej-ka) in [#12107](https://github.com/facebook/react/pull/12107) and [@gaearon](https://github.com/gaearon) in [#12154](https://github.com/facebook/react/pull/12154))
* Shallow renderer should assign state to `null` for components that don't set it. ([@jwbay](https://github.com/jwbay) in [#11965](https://github.com/facebook/react/pull/11965))
@@ -699,7 +782,7 @@ Starting with 16.1.0, we will no longer be publishing new releases on Bower. You
* Fix bug in QtWebKit when wrapping synthetic events in proxies. ([@walrusfruitcake](https://github.com/walrusfruitcake) in [#10115](https://github.com/facebook/react/pull/10011))
* Prevent event handlers from receiving extra argument in development. ([@aweary](https://github.com/aweary) in [#10115](https://github.com/facebook/react/pull/8363))
* Fix cases where `onChange` would not fire with `defaultChecked` on radio inputs. ([@jquense](https://github.com/jquense) in [#10156](https://github.com/facebook/react/pull/10156))
* Add support for `controlList` attribute to DOM property whitelist ([@nhunzaker](https://github.com/nhunzaker) in [#9940](https://github.com/facebook/react/pull/9940))
* Add support for `controlList` attribute to allowed DOM properties ([@nhunzaker](https://github.com/nhunzaker) in [#9940](https://github.com/facebook/react/pull/9940))
* Fix a bug where creating an element with a ref in a constructor did not throw an error in development. ([@iansu](https://github.com/iansu) in [#10025](https://github.com/facebook/react/pull/10025))
## 15.6.1 (June 14, 2017)

View File

@@ -1,3 +1,76 @@
# Code of Conduct
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://code.fb.com/codeofconduct/) so that you can understand what actions will and will not be tolerated.
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at <opensource-conduct@fb.com>. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

View File

@@ -4,7 +4,7 @@ React is a JavaScript library for building user interfaces.
* **Declarative:** React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes. Declarative views make your code more predictable, simpler to understand, and easier to debug.
* **Component-Based:** Build encapsulated components that manage their own state, then compose them to make complex UIs. Since component logic is written in JavaScript instead of templates, you can easily pass rich data through your app and keep state out of the DOM.
* **Learn Once, Write Anywhere:** We don't make assumptions about the rest of your technology stack, so you can develop new features in React without rewriting existing code. React can also render on the server using Node and power mobile apps using [React Native](https://facebook.github.io/react-native/).
* **Learn Once, Write Anywhere:** We don't make assumptions about the rest of your technology stack, so you can develop new features in React without rewriting existing code. React can also render on the server using Node and power mobile apps using [React Native](https://reactnative.dev/).
[Learn how to use React in your own project](https://reactjs.org/docs/getting-started.html).
@@ -16,7 +16,7 @@ React has been designed for gradual adoption from the start, and **you can use a
* [Add React to a Website](https://reactjs.org/docs/add-react-to-a-website.html) as a `<script>` tag in one minute.
* [Create a New React App](https://reactjs.org/docs/create-a-new-react-app.html) if you're looking for a powerful JavaScript toolchain.
You can use React as a `<script>` tag from a [CDN](https://reactjs.org/docs/cdn-links.html), or as a `react` package on [npm](https://www.npmjs.com/).
You can use React as a `<script>` tag from a [CDN](https://reactjs.org/docs/cdn-links.html), or as a `react` package on [npm](https://www.npmjs.com/package/react).
## Documentation

7
SECURITY.md Normal file
View File

@@ -0,0 +1,7 @@
# Reporting Security Issues
If you believe you have found a security vulnerability in React, we encourage you to let us know right away. We will investigate all legitimate reports and do our best to quickly fix the problem.
Please refer to the following page for our responsible disclosure policy, reward guidelines, and those things that should not be reported:
https://www.facebook.com/whitehat

View File

@@ -32,6 +32,14 @@ const {generateResultsArray} = require('./scripts/rollup/stats');
const {existsSync, readFileSync} = require('fs');
const {exec} = require('child_process');
// This must match the name of the CI job that creates the build artifacts
const RELEASE_CHANNEL =
process.env.RELEASE_CHANNEL === 'experimental' ? 'experimental' : 'stable';
const artifactsJobName =
process.env.RELEASE_CHANNEL === 'experimental'
? 'process_artifacts_experimental'
: 'process_artifacts';
if (!existsSync('./build/bundle-sizes.json')) {
// This indicates the build failed previously.
// In that case, there's nothing for the Dangerfile to do.
@@ -117,6 +125,8 @@ function git(args) {
return;
}
markdown(`## Size changes (${RELEASE_CHANNEL})`);
const upstreamRef = danger.github.pr.base.ref;
await git(`remote add upstream https://github.com/facebook/react.git`);
await git('fetch upstream');
@@ -135,8 +145,7 @@ function git(args) {
}
for (let i = 0; i < statuses.length; i++) {
const status = statuses[i];
// This must match the name of the CI job that creates the build artifacts
if (status.context === 'ci/circleci: process_artifacts') {
if (status.context === `ci/circleci: ${artifactsJobName}`) {
if (status.state === 'success') {
baseCIBuildId = /\/facebook\/react\/([0-9]+)/.exec(
status.target_url
@@ -162,7 +171,7 @@ function git(args) {
for (let i = 0; i < baseArtifactsInfo.length; i++) {
const info = baseArtifactsInfo[i];
if (info.path === 'home/circleci/project/build/bundle-sizes.json') {
if (info.path.endsWith('bundle-sizes.json')) {
const resultsResponse = await fetch(info.url);
previousBuildResults = await resultsResponse.json();
break;

View File

@@ -461,9 +461,7 @@ function prepareState(initGlobals) {
hasSameBehaviorForAll,
rowPatternHash,
// "Good enough" id that we can store in localStorage
rowIdHash: `${attribute.name} ${attribute.tagName} ${
attribute.overrideStringValue
}`,
rowIdHash: `${attribute.name} ${attribute.tagName} ${attribute.overrideStringValue}`,
};
const rowGroup = rowPatternHashes.get(rowPatternHash) || new Set();
rowGroup.add(row);
@@ -866,14 +864,12 @@ class App extends React.Component {
// Sort
switch (sortOrder) {
case ALPHABETICAL:
return filteredAttributes.sort(
(attr1, attr2) =>
attr1.name.toLowerCase() < attr2.name.toLowerCase() ? -1 : 1
return filteredAttributes.sort((attr1, attr2) =>
attr1.name.toLowerCase() < attr2.name.toLowerCase() ? -1 : 1
);
case REV_ALPHABETICAL:
return filteredAttributes.sort(
(attr1, attr2) =>
attr1.name.toLowerCase() < attr2.name.toLowerCase() ? 1 : -1
return filteredAttributes.sort((attr1, attr2) =>
attr1.name.toLowerCase() < attr2.name.toLowerCase() ? 1 : -1
);
case GROUPED_BY_ROW_PATTERN: {
return filteredAttributes.sort((attr1, attr2) => {

View File

@@ -255,7 +255,7 @@ const attributes = [
{
name: 'cite',
tagName: 'blockquote',
overrideStringValue: 'http://reactjs.com/',
overrideStringValue: 'https://reactjs.com/',
},
{name: 'class', read: getAttribute('class')},
{name: 'classID', tagName: 'object', read: getAttribute('classid')},
@@ -453,6 +453,11 @@ const attributes = [
tagName: 'video',
read: getProperty('disablepictureinpicture'),
},
{
name: 'disableRemotePlayback',
tagName: 'video',
read: getProperty('disableremoteplayback'),
},
{
name: 'display',
tagName: 'svg',

View File

@@ -268,7 +268,7 @@ async-each@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d"
async@^1.4.0, async@^1.5.2:
async@^1.5.2:
version "1.5.2"
resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
@@ -1448,6 +1448,10 @@ commander@2.11.x, commander@~2.11.0:
version "2.11.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563"
commander@~2.20.3:
version "2.20.3"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
commondir@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b"
@@ -2838,14 +2842,14 @@ handle-thing@^1.2.5:
resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-1.2.5.tgz#fd7aad726bf1a5fd16dfc29b2f7a6601d27139c4"
handlebars@^4.0.3:
version "4.0.10"
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.10.tgz#3d30c718b09a3d96f23ea4cc1f403c4d3ba9ff4f"
version "4.5.3"
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.5.3.tgz#5cf75bd8714f7605713511a56be7c349becb0482"
dependencies:
async "^1.4.0"
neo-async "^2.6.0"
optimist "^0.6.1"
source-map "^0.4.4"
source-map "^0.6.1"
optionalDependencies:
uglify-js "^2.6"
uglify-js "^3.1.4"
har-schema@^1.0.5:
version "1.0.5"
@@ -4180,6 +4184,10 @@ negotiator@0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9"
neo-async@^2.6.0:
version "2.6.1"
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c"
no-case@^2.2.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.1.tgz#7aeba1c73a52184265554b7dc03baf720df80081"
@@ -5696,11 +5704,9 @@ source-map@0.5.x, source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, sourc
version "0.5.7"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
source-map@^0.4.4:
version "0.4.4"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b"
dependencies:
amdefine ">=0.0.4"
source-map@^0.6.1, source-map@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
source-map@~0.2.0:
version "0.2.0"
@@ -6090,7 +6096,7 @@ uglify-js@3.0.x, uglify-js@^3.0.13:
commander "~2.11.0"
source-map "~0.5.1"
uglify-js@^2.6, uglify-js@^2.8.29:
uglify-js@^2.8.29:
version "2.8.29"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd"
dependencies:
@@ -6099,6 +6105,13 @@ uglify-js@^2.6, uglify-js@^2.8.29:
optionalDependencies:
uglify-to-browserify "~1.0.0"
uglify-js@^3.1.4:
version "3.7.3"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.7.3.tgz#f918fce9182f466d5140f24bb0ff35c2d32dcc6a"
dependencies:
commander "~2.20.3"
source-map "~0.6.1"
uglify-to-browserify@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7"

1
fixtures/blocks/.env Normal file
View File

@@ -0,0 +1 @@
SKIP_PREFLIGHT_CHECK=true

77
fixtures/blocks/db.json Normal file
View File

@@ -0,0 +1,77 @@
{
"posts": [
{
"id": 1,
"userId": 2,
"title": "Welcome",
"body": "Hello, world!"
},
{
"id": 2,
"userId": 3,
"title": "A Guide to useEffect",
"body": "Let me tell you everything about useEffect"
},
{
"id": 3,
"userId": 1,
"title": "Here and There",
"body": "Browsers are smart"
}
],
"comments": [
{
"id": 1,
"body": "Hey there",
"postId": 1,
"userId": 1
},
{
"id": 2,
"body": "Welcome to the chat",
"postId": 1,
"userId": 2
},
{
"id": 3,
"body": "What editor/font are you using?",
"postId": 2,
"userId": 2
},
{
"id": 4,
"body": "It's always been hard",
"postId": 3,
"userId": 1
},
{
"id": 5,
"body": "It's still easy",
"postId": 3,
"userId": 2
}
],
"users": [{
"id": 1,
"name": "Sebastian",
"bioId": 10
}, {
"id": 2,
"name": "Sophie",
"bioId": 20
}, {
"id": 3,
"name": "Dan",
"bioId": 30
}],
"bios": [{
"id": 10,
"text": "I like European movies"
}, {
"id": 20,
"text": "I like math puzzles"
}, {
"id": 30,
"text": "I like reading twitter"
}]
}

14
fixtures/blocks/delay.js Normal file
View File

@@ -0,0 +1,14 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
module.exports = (req, res, next) => {
if (req.query.delay) {
setTimeout(next, Number(req.query.delay));
} else {
next();
}
};

View File

@@ -0,0 +1,37 @@
{
"name": "blocks",
"version": "0.1.0",
"private": true,
"proxy": "http://localhost:3001/",
"dependencies": {
"concurrently": "^5.2.0",
"json-server": "^0.16.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1"
},
"scripts": {
"prestart": "cp -r ../../build/node_modules/* ./node_modules/",
"prebuild": "cp -r ../../build/node_modules/* ./node_modules/",
"start": "concurrently \"npm run start:client\" \"npm run start:api\"",
"start:api": "json-server --watch db.json --port 3001 --delay 1000 --middlewares delay.js",
"start:client": "react-scripts start",
"build": "react-scripts build",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Blocks Fixture</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>

View File

@@ -0,0 +1,105 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, {
useReducer,
useEffect,
unstable_useTransition as useTransition,
useCallback,
useMemo,
Suspense,
} from 'react';
import {createCache, CacheProvider} from 'react/unstable-cache';
import {RouterProvider} from './client/RouterContext';
// TODO: can't really import a server component on the client.
import App from './server/App';
const initialUrl = window.location.pathname;
const initialState = {
// TODO: use this for invalidation.
cache: createCache(),
url: initialUrl,
pendingUrl: initialUrl,
root: <App route={initialUrl} />,
};
function reducer(state, action) {
switch (action.type) {
case 'startNavigation':
return {
...state,
pendingUrl: action.url,
};
case 'completeNavigation':
// TODO: cancel previous fetch?
return {
...state,
url: action.url,
pendingUrl: action.url,
root: action.root,
};
default:
throw new Error();
}
}
function Router() {
const [state, dispatch] = useReducer(reducer, initialState);
const [startTransition, isPending] = useTransition({
timeoutMs: 1500,
});
useEffect(() => {
document.body.style.cursor = isPending ? 'wait' : '';
}, [isPending]);
const navigate = useCallback(
url => {
startTransition(() => {
// TODO: Here, There, and Everywhere.
// TODO: Instant Transitions, somehow.
dispatch({
type: 'completeNavigation',
root: <App route={url} />,
url,
});
});
dispatch({
type: 'startNavigation',
url,
});
},
[startTransition]
);
useEffect(() => {
const listener = () => {
navigate(window.location.pathname);
};
window.addEventListener('popstate', listener);
return () => window.removeEventListener('popstate', listener);
}, [navigate]);
const routeContext = useMemo(
() => ({
pendingUrl: state.pendingUrl,
url: state.url,
navigate,
}),
[state.url, state.pendingUrl, navigate]
);
return (
<Suspense fallback={<h2>Loading...</h2>}>
<CacheProvider value={state.cache}>
<RouterProvider value={routeContext}>{state.root}</RouterProvider>
</CacheProvider>
</Suspense>
);
}
export default Router;

View File

@@ -0,0 +1,25 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import * as React from 'react';
import {useRouter} from './RouterContext';
export default function Link({to, children, ...rest}) {
const {navigate} = useRouter();
return (
<a
href={to}
onClick={e => {
e.preventDefault();
window.history.pushState(null, null, to);
navigate(to);
}}
{...rest}>
{children}
</a>
);
}

View File

@@ -0,0 +1,21 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable import/first */
import * as React from 'react';
import {TabBar, TabLink} from '../client/TabNav';
export default function ProfileNav({userId}) {
// TODO: Don't hardcode ID.
return (
<TabBar>
<TabLink to={`/profile/${userId}`}>Timeline</TabLink>
<TabLink to={`/profile/${userId}/bio`}>Bio</TabLink>
</TabBar>
);
}

View File

@@ -0,0 +1,9 @@
import {createContext, useContext} from 'react';
const RouterContext = createContext(null);
export const RouterProvider = RouterContext.Provider;
export function useRouter() {
return useContext(RouterContext);
}

View File

@@ -0,0 +1,31 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import * as React from 'react';
import {TabBar, TabLink} from './TabNav';
// TODO: Error Boundaries.
function MainTabNav() {
return (
<TabBar>
<TabLink to="/">Home</TabLink>
<TabLink to="/profile/3" partial={true}>
Profile
</TabLink>
</TabBar>
);
}
export default function Shell({children}) {
return (
<>
<MainTabNav />
{children}
</>
);
}

View File

@@ -0,0 +1,50 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import * as React from 'react';
import Link from './Link';
import {useRouter} from './RouterContext';
export function TabBar({children}) {
return (
<div
style={{
border: '1px solid #aaa',
padding: 20,
marginBottom: 20,
width: 500,
}}>
{children}
</div>
);
}
export function TabLink({to, partial, children}) {
const {pendingUrl: activeUrl} = useRouter();
const active = partial ? activeUrl.startsWith(to) : activeUrl === to;
if (active) {
return (
<b
style={{
display: 'inline-block',
marginRight: 20,
}}>
{children}
</b>
);
}
return (
<Link
style={{
display: 'inline-block',
marginRight: 20,
}}
to={to}>
{children}
</Link>
);
}

View File

@@ -0,0 +1,8 @@
body {
font-family: Helvetica;
padding-left: 10px;
}
* {
box-sizing: border-box;
}

View File

@@ -0,0 +1,13 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
import {unstable_createRoot as createRoot} from 'react-dom';
import './index.css';
import Router from './Router';
createRoot(document.getElementById('root')).render(<Router />);

View File

@@ -0,0 +1,28 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable import/first */
import * as React from 'react';
import {matchRoute} from './ServerRouter';
import FeedPage from './FeedPage';
import ProfilePage from './ProfilePage';
// TODO: Replace with asset reference.
import Shell from '../client/Shell';
// TODO: Router component?
const AppRoutes = {
'/': props => <FeedPage {...props} key="home" />,
'/profile/:userId/*': props => (
<ProfilePage {...props} key={`profile-${props.userId}`} />
),
};
export default function App(props) {
const match = matchRoute(props, AppRoutes);
return <Shell>{match}</Shell>;
}

View File

@@ -0,0 +1,31 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable import/first */
import * as React from 'react';
import {fetch} from 'react-fetch';
// TODO: Replace with asset reference.
import Link from '../client/Link';
export default function Comments({postId}) {
const comments = fetch(`/comments?postId=${postId}&_expand=user`).json();
return (
<>
<h5>Comments</h5>
<ul>
{comments.slice(0, 5).map(comment => (
<li key={comment.id}>
{comment.body}
{' • '}
<Link to={`/profile/${comment.user.id}`}>{comment.user.name}</Link>
</li>
))}
</ul>
</>
);
}

View File

@@ -0,0 +1,21 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable import/first */
import * as React from 'react';
import {fetch} from 'react-fetch';
import PostList from './PostList';
export default function Feed() {
const posts = fetch('/posts?_expand=user').json();
return (
<>
<h2>Feed</h2>
<PostList posts={posts} />
</>
);
}

View File

@@ -0,0 +1,20 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable import/first */
import * as React from 'react';
import {Suspense} from 'react';
import PostGlimmer from './PostGlimmer';
import Feed from './Feed';
export default function FeedPage() {
return (
<Suspense fallback={<PostGlimmer />}>
<Feed />
</Suspense>
);
}

View File

@@ -0,0 +1,39 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable import/first */
import * as React from 'react';
import {Suspense} from 'react';
import Comments from './Comments';
// TODO: Replace with asset reference.
import Link from '../client/Link';
export default function Post({post}) {
return (
<div
style={{
border: '1px solid #aaa',
borderRadius: 10,
marginBottom: 20,
padding: 20,
maxWidth: 500,
}}>
<h4 style={{marginTop: 0}}>
{post.title}
{' by '}
<Link to={`/profile/${post.user.id}`}>{post.user.name}</Link>
</h4>
<p>{post.body}</p>
<Suspense
fallback={<h5>Loading comments...</h5>}
unstable_avoidThisFallback={true}>
<Comments postId={post.id} />
</Suspense>
</div>
);
}

View File

@@ -0,0 +1,56 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable import/first */
import * as React from 'react';
export default function PostGlimmer() {
return (
<div
style={{
border: '1px solid #aaa',
borderRadius: 10,
marginBottom: 20,
padding: 20,
maxWidth: 500,
height: 180,
}}>
<div
style={{
marginBottom: 20,
width: '50%',
height: 20,
background: '#ddd',
}}
/>
<div
style={{
marginBottom: 20,
width: '60%',
height: 20,
background: '#eee',
}}
/>
<div
style={{
marginBottom: 20,
width: '50%',
height: 20,
background: '#eee',
}}
/>
<div
style={{
marginBottom: 20,
width: '60%',
height: 20,
background: '#eee',
}}
/>
</div>
);
}

View File

@@ -0,0 +1,28 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable import/first */
import * as React from 'react';
import {Suspense, unstable_SuspenseList as SuspenseList} from 'react';
import {preload} from 'react-fetch';
import PostGlimmer from './PostGlimmer';
import Post from './Post';
export default function PostList({posts}) {
return (
<SuspenseList revealOrder="forwards" tail="collapsed">
{posts.map(post => {
preload(`/comments?postId=${post.id}&_expand=user`);
return (
<Suspense key={post.id} fallback={<PostGlimmer />}>
<Post post={post} />
</Suspense>
);
})}
</SuspenseList>
);
}

View File

@@ -0,0 +1,21 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable import/first */
import * as React from 'react';
import {fetch} from 'react-fetch';
export default function ProfileBio({userId}) {
const user = fetch(`/users/${userId}`).json();
const bio = fetch(`/bios/${user.bioId}`).json().text;
return (
<>
<h3>{user.name}'s Bio</h3>
<p>{bio}</p>
</>
);
}

View File

@@ -0,0 +1,34 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import * as React from 'react';
import {Suspense} from 'react';
import {fetch} from 'react-fetch';
import {matchRoute} from './ServerRouter';
import ProfileTimeline from './ProfileTimeline';
import ProfileBio from './ProfileBio';
// TODO: Replace with asset reference.
import ProfileNav from '../client/ProfileNav';
// TODO: Router component?
const ProfileRoutes = {
'/': props => <ProfileTimeline {...props} key="timeline" />,
'/bio': props => <ProfileBio {...props} key="bio" />,
};
export default function ProfilePage(props) {
const user = fetch(`/users/${props.userId}`).json();
const match = matchRoute(props, ProfileRoutes);
return (
<>
<h2>{user.name}</h2>
<ProfileNav userId={user.id} />
<Suspense fallback={<h3>Loading...</h3>}>{match}</Suspense>
</>
);
}

View File

@@ -0,0 +1,16 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable import/first */
import * as React from 'react';
import {fetch} from 'react-fetch';
import PostList from './PostList';
export default function ProfileTimeline({userId}) {
const posts = fetch(`/posts?userId=${userId}&_expand=user`).json();
return <PostList posts={posts} />;
}

View File

@@ -0,0 +1,54 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable import/first */
function tryMatch(props, def) {
const defSegments = def.split('/').filter(Boolean);
const routeSegments = props.route.split('/').filter(Boolean);
let innerProps = {...props};
while (routeSegments.length > 0) {
if (defSegments.length === 0) {
return null;
}
const urlSegment = routeSegments.shift();
const defSegment = defSegments.shift();
if (urlSegment === defSegment) {
continue;
}
if (defSegment[0] === ':') {
innerProps[defSegment.slice(1)] = urlSegment;
continue;
}
if (defSegment === '*') {
innerProps.route = '/' + urlSegment + routeSegments.join('/');
return innerProps;
}
return null;
}
if (defSegments.length === 0) {
return innerProps;
}
if (defSegments.length === 1 && defSegments[0] === '*') {
innerProps.route = '/';
return innerProps;
}
return null;
}
export function matchRoute(props, defs) {
for (let def in defs) {
if (!defs.hasOwnProperty(def)) {
continue;
}
const innerProps = tryMatch(props, def);
if (innerProps) {
const match = defs[def](innerProps);
return match;
}
}
throw Error('Not found.');
}

11163
fixtures/blocks/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -1,5 +1,5 @@
import React, {PureComponent} from 'react';
import {flushSync, unstable_createRoot} from 'react-dom';
import {flushSync, createRoot} from 'react-dom';
import Scheduler from 'scheduler';
import _ from 'lodash';
import Charts from './Charts';
@@ -107,9 +107,10 @@ class App extends PureComponent {
this.debouncedHandleChange(value);
break;
case 'async':
unstable_scheduleCallback(() => {
// TODO: useTransition hook instead.
setTimeout(() => {
this.setState({value});
});
}, 0);
break;
default:
break;
@@ -146,5 +147,5 @@ class App extends PureComponent {
}
const container = document.getElementById('root');
const root = ReactDOM.unstable_createRoot(container);
root.render(<App />, container);
const root = createRoot(container);
root.render(<App />);

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>React 14.9</title>
<link rel="stylesheet" href="styles.css" />
<script type="text/javascript">
// Enable DevTools to inspect React inside of an <iframe>
// This must run before React is loaded
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
</script>
<script src="https://unpkg.com/react@0.14.9/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@0.14.9/dist/react-dom.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root">
If you are seeing this message, you are likely viewing this file using the <code>file</code> protocol which does not support cross origin requests.
<br/><br/>
Use the <code>server</code> script instead:
<br/><br/>
<code>node ./fixtures/devtools/regression/server.js</code><br/>
<code>open <a href="http://localhost:3000/14.9.html">http://localhost:3000/14.9.html</a></code>
</div>
<script src="shared.js" type="text/babel"></script>
<!--
This is a great way to try React but it's not suitable for production.
It slowly compiles JSX with Babel in the browser and uses a large development build of React.
Learn more at https://reactjs.org/docs/getting-started.html
-->
</body>
</html>

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>React 15.0</title>
<link rel="stylesheet" href="styles.css" />
<script type="text/javascript">
// Enable DevTools to inspect React inside of an <iframe>
// This must run before React is loaded
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
</script>
<script src="https://unpkg.com/react@15.0/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@15.0/dist/react-dom.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root">
If you are seeing this message, you are likely viewing this file using the <code>file</code> protocol which does not support cross origin requests.
<br/><br/>
Use the <code>server</code> script instead:
<br/><br/>
<code>node ./fixtures/devtools/regression/server.js</code><br/>
<code>open <a href="http://localhost:3000/15.0.html">http://localhost:3000/15.0.html</a></code>
</div>
<script src="shared.js" type="text/babel"></script>
<!--
This is a great way to try React but it's not suitable for production.
It slowly compiles JSX with Babel in the browser and uses a large development build of React.
Learn more at https://reactjs.org/docs/getting-started.html
-->
</body>
</html>

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>React 15.1</title>
<link rel="stylesheet" href="styles.css" />
<script type="text/javascript">
// Enable DevTools to inspect React inside of an <iframe>
// This must run before React is loaded
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
</script>
<script src="https://unpkg.com/react@15.1/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@15.1/dist/react-dom.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root">
If you are seeing this message, you are likely viewing this file using the <code>file</code> protocol which does not support cross origin requests.
<br/><br/>
Use the <code>server</code> script instead:
<br/><br/>
<code>node ./fixtures/devtools/regression/server.js</code><br/>
<code>open <a href="http://localhost:3000/15.1.html">http://localhost:3000/15.1.html</a></code>
</div>
<script src="shared.js" type="text/babel"></script>
<!--
This is a great way to try React but it's not suitable for production.
It slowly compiles JSX with Babel in the browser and uses a large development build of React.
Learn more at https://reactjs.org/docs/getting-started.html
-->
</body>
</html>

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>React 15.2</title>
<link rel="stylesheet" href="styles.css" />
<script type="text/javascript">
// Enable DevTools to inspect React inside of an <iframe>
// This must run before React is loaded
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
</script>
<script src="https://unpkg.com/react@15.2/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@15.2/dist/react-dom.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root">
If you are seeing this message, you are likely viewing this file using the <code>file</code> protocol which does not support cross origin requests.
<br/><br/>
Use the <code>server</code> script instead:
<br/><br/>
<code>node ./fixtures/devtools/regression/server.js</code><br/>
<code>open <a href="http://localhost:3000/15.2.html">http://localhost:3000/15.2.html</a></code>
</div>
<script src="shared.js" type="text/babel"></script>
<!--
This is a great way to try React but it's not suitable for production.
It slowly compiles JSX with Babel in the browser and uses a large development build of React.
Learn more at https://reactjs.org/docs/getting-started.html
-->
</body>
</html>

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>React 15.3</title>
<link rel="stylesheet" href="styles.css" />
<script type="text/javascript">
// Enable DevTools to inspect React inside of an <iframe>
// This must run before React is loaded
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
</script>
<script src="https://unpkg.com/react@15.3/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@15.3/dist/react-dom.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root">
If you are seeing this message, you are likely viewing this file using the <code>file</code> protocol which does not support cross origin requests.
<br/><br/>
Use the <code>server</code> script instead:
<br/><br/>
<code>node ./fixtures/devtools/regression/server.js</code><br/>
<code>open <a href="http://localhost:3000/15.3.html">http://localhost:3000/15.3.html</a></code>
</div>
<script src="shared.js" type="text/babel"></script>
<!--
This is a great way to try React but it's not suitable for production.
It slowly compiles JSX with Babel in the browser and uses a large development build of React.
Learn more at https://reactjs.org/docs/getting-started.html
-->
</body>
</html>

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>React 15.4</title>
<link rel="stylesheet" href="styles.css" />
<script type="text/javascript">
// Enable DevTools to inspect React inside of an <iframe>
// This must run before React is loaded
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
</script>
<script src="https://unpkg.com/react@15.4/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@15.4/dist/react-dom.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root">
If you are seeing this message, you are likely viewing this file using the <code>file</code> protocol which does not support cross origin requests.
<br/><br/>
Use the <code>server</code> script instead:
<br/><br/>
<code>node ./fixtures/devtools/regression/server.js</code><br/>
<code>open <a href="http://localhost:3000/15.4.html">http://localhost:3000/15.4.html</a></code>
</div>
<script src="shared.js" type="text/babel"></script>
<!--
This is a great way to try React but it's not suitable for production.
It slowly compiles JSX with Babel in the browser and uses a large development build of React.
Learn more at https://reactjs.org/docs/getting-started.html
-->
</body>
</html>

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>React 15.5</title>
<link rel="stylesheet" href="styles.css" />
<script type="text/javascript">
// Enable DevTools to inspect React inside of an <iframe>
// This must run before React is loaded
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
</script>
<script src="https://unpkg.com/react@15.5/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@15.5/dist/react-dom.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root">
If you are seeing this message, you are likely viewing this file using the <code>file</code> protocol which does not support cross origin requests.
<br/><br/>
Use the <code>server</code> script instead:
<br/><br/>
<code>node ./fixtures/devtools/regression/server.js</code><br/>
<code>open <a href="http://localhost:3000/15.5.html">http://localhost:3000/15.5.html</a></code>
</div>
<script src="shared.js" type="text/babel"></script>
<!--
This is a great way to try React but it's not suitable for production.
It slowly compiles JSX with Babel in the browser and uses a large development build of React.
Learn more at https://reactjs.org/docs/getting-started.html
-->
</body>
</html>

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>React 15.6</title>
<link rel="stylesheet" href="styles.css" />
<script type="text/javascript">
// Enable DevTools to inspect React inside of an <iframe>
// This must run before React is loaded
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
</script>
<script src="https://unpkg.com/react@15.6/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@15.6/dist/react-dom.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root">
If you are seeing this message, you are likely viewing this file using the <code>file</code> protocol which does not support cross origin requests.
<br/><br/>
Use the <code>server</code> script instead:
<br/><br/>
<code>node ./fixtures/devtools/regression/server.js</code><br/>
<code>open <a href="http://localhost:3000/15.6.html">http://localhost:3000/15.6.html</a></code>
</div>
<script src="shared.js" type="text/babel"></script>
<!--
This is a great way to try React but it's not suitable for production.
It slowly compiles JSX with Babel in the browser and uses a large development build of React.
Learn more at https://reactjs.org/docs/getting-started.html
-->
</body>
</html>

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>React 16.0</title>
<link rel="stylesheet" href="styles.css" />
<script type="text/javascript">
// Enable DevTools to inspect React inside of an <iframe>
// This must run before React is loaded
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
</script>
<script src="https://unpkg.com/react@16.0/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16.0/umd/react-dom.development.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root">
If you are seeing this message, you are likely viewing this file using the <code>file</code> protocol which does not support cross origin requests.
<br/><br/>
Use the <code>server</code> script instead:
<br/><br/>
<code>node ./fixtures/devtools/regression/server.js</code><br/>
<code>open <a href="http://localhost:3000/16.0.html">http://localhost:3000/16.0.html</a></code>
</div>
<script src="shared.js" type="text/babel"></script>
<!--
This is a great way to try React but it's not suitable for production.
It slowly compiles JSX with Babel in the browser and uses a large development build of React.
Learn more at https://reactjs.org/docs/getting-started.html
-->
</body>
</html>

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>React 16.1</title>
<link rel="stylesheet" href="styles.css" />
<script type="text/javascript">
// Enable DevTools to inspect React inside of an <iframe>
// This must run before React is loaded
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
</script>
<script src="https://unpkg.com/react@16.1/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16.1/umd/react-dom.development.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root">
If you are seeing this message, you are likely viewing this file using the <code>file</code> protocol which does not support cross origin requests.
<br/><br/>
Use the <code>server</code> script instead:
<br/><br/>
<code>node ./fixtures/devtools/regression/server.js</code><br/>
<code>open <a href="http://localhost:3000/16.1.html">http://localhost:3000/16.1.html</a></code>
</div>
<script src="shared.js" type="text/babel"></script>
<!--
This is a great way to try React but it's not suitable for production.
It slowly compiles JSX with Babel in the browser and uses a large development build of React.
Learn more at https://reactjs.org/docs/getting-started.html
-->
</body>
</html>

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>React 16.2</title>
<link rel="stylesheet" href="styles.css" />
<script type="text/javascript">
// Enable DevTools to inspect React inside of an <iframe>
// This must run before React is loaded
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
</script>
<script src="https://unpkg.com/react@16.2/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16.2/umd/react-dom.development.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root">
If you are seeing this message, you are likely viewing this file using the <code>file</code> protocol which does not support cross origin requests.
<br/><br/>
Use the <code>server</code> script instead:
<br/><br/>
<code>node ./fixtures/devtools/regression/server.js</code><br/>
<code>open <a href="http://localhost:3000/16.2.html">http://localhost:3000/16.2.html</a></code>
</div>
<script src="shared.js" type="text/babel"></script>
<!--
This is a great way to try React but it's not suitable for production.
It slowly compiles JSX with Babel in the browser and uses a large development build of React.
Learn more at https://reactjs.org/docs/getting-started.html
-->
</body>
</html>

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>React 16.3</title>
<link rel="stylesheet" href="styles.css" />
<script type="text/javascript">
// Enable DevTools to inspect React inside of an <iframe>
// This must run before React is loaded
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
</script>
<script src="https://unpkg.com/react@16.3/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16.3/umd/react-dom.development.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root">
If you are seeing this message, you are likely viewing this file using the <code>file</code> protocol which does not support cross origin requests.
<br/><br/>
Use the <code>server</code> script instead:
<br/><br/>
<code>node ./fixtures/devtools/regression/server.js</code><br/>
<code>open <a href="http://localhost:3000/16.3.html">http://localhost:3000/16.3.html</a></code>
</div>
<script src="shared.js" type="text/babel"></script>
<!--
This is a great way to try React but it's not suitable for production.
It slowly compiles JSX with Babel in the browser and uses a large development build of React.
Learn more at https://reactjs.org/docs/getting-started.html
-->
</body>
</html>

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>React 16.4</title>
<link rel="stylesheet" href="styles.css" />
<script type="text/javascript">
// Enable DevTools to inspect React inside of an <iframe>
// This must run before React is loaded
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
</script>
<script src="https://unpkg.com/react@16.4/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16.4/umd/react-dom.development.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root">
If you are seeing this message, you are likely viewing this file using the <code>file</code> protocol which does not support cross origin requests.
<br/><br/>
Use the <code>server</code> script instead:
<br/><br/>
<code>node ./fixtures/devtools/regression/server.js</code><br/>
<code>open <a href="http://localhost:3000/16.4.html">http://localhost:3000/16.4.html</a></code>
</div>
<script src="shared.js" type="text/babel"></script>
<!--
This is a great way to try React but it's not suitable for production.
It slowly compiles JSX with Babel in the browser and uses a large development build of React.
Learn more at https://reactjs.org/docs/getting-started.html
-->
</body>
</html>

View File

@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>React 16.5</title>
<link rel="stylesheet" href="styles.css" />
<script type="text/javascript">
// Enable DevTools to inspect React inside of an <iframe>
// This must run before React is loaded
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
</script>
<script src="https://unpkg.com/schedule@0.5.0/umd/schedule.development.js"></script>
<script src="https://unpkg.com/schedule@0.5.0/umd/schedule-tracing.development.js"></script>
<script src="https://unpkg.com/react@16.5/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16.5/umd/react-dom.development.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root">
If you are seeing this message, you are likely viewing this file using the <code>file</code> protocol which does not support cross origin requests.
<br/><br/>
Use the <code>server</code> script instead:
<br/><br/>
<code>node ./fixtures/devtools/regression/server.js</code><br/>
<code>open <a href="http://localhost:3000/16.5.html">http://localhost:3000/16.5.html</a></code>
</div>
<script src="shared.js" type="text/babel"></script>
<!--
This is a great way to try React but it's not suitable for production.
It slowly compiles JSX with Babel in the browser and uses a large development build of React.
Learn more at https://reactjs.org/docs/getting-started.html
-->
</body>
</html>

View File

@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>React 16.6</title>
<link rel="stylesheet" href="styles.css" />
<script type="text/javascript">
// Enable DevTools to inspect React inside of an <iframe>
// This must run before React is loaded
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
</script>
<script src="https://unpkg.com/scheduler@0.10.0/umd/scheduler.development.js"></script>
<script src="https://unpkg.com/scheduler@0.10.0/umd/scheduler-tracing.development.js"></script>
<script src="https://unpkg.com/react@16.6/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16.6/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/react-cache@2.0.0-alpha.1/umd/react-cache.development.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root">
If you are seeing this message, you are likely viewing this file using the <code>file</code> protocol which does not support cross origin requests.
<br/><br/>
Use the <code>server</code> script instead:
<br/><br/>
<code>node ./fixtures/devtools/regression/server.js</code><br/>
<code>open <a href="http://localhost:3000/16.6.html">http://localhost:3000/16.6.html</a></code>
</div>
<script src="shared.js" type="text/babel"></script>
<!--
This is a great way to try React but it's not suitable for production.
It slowly compiles JSX with Babel in the browser and uses a large development build of React.
Learn more at https://reactjs.org/docs/getting-started.html
-->
</body>
</html>

View File

@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>React 16.7</title>
<link rel="stylesheet" href="styles.css" />
<script type="text/javascript">
// Enable DevTools to inspect React inside of an <iframe>
// This must run before React is loaded
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
</script>
<script src="https://unpkg.com/scheduler@0.12.0/umd/scheduler.development.js"></script>
<script src="https://unpkg.com/scheduler@0.12.0/umd/scheduler-tracing.development.js"></script>
<script src="https://unpkg.com/react@16.7/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16.7/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/react-cache@2.0.0-alpha.1/umd/react-cache.development.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root">
If you are seeing this message, you are likely viewing this file using the <code>file</code> protocol which does not support cross origin requests.
<br/><br/>
Use the <code>server</code> script instead:
<br/><br/>
<code>node ./fixtures/devtools/regression/server.js</code><br/>
<code>open <a href="http://localhost:3000/16.7.html">http://localhost:3000/16.7.html</a></code>
</div>
<script src="shared.js" type="text/babel"></script>
<!--
This is a great way to try React but it's not suitable for production.
It slowly compiles JSX with Babel in the browser and uses a large development build of React.
Learn more at https://reactjs.org/docs/getting-started.html
-->
</body>
</html>

View File

@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>React canary</title>
<link rel="stylesheet" href="styles.css" />
<script type="text/javascript">
// Enable DevTools to inspect React inside of an <iframe>
// This must run before React is loaded
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
</script>
<script src="https://unpkg.com/scheduler@canary/umd/scheduler.development.js"></script>
<script src="https://unpkg.com/scheduler@canary/umd/scheduler-tracing.development.js"></script>
<script src="https://unpkg.com/react@canary/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@canary/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/react-cache@next/umd/react-cache.development.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root">
If you are seeing this message, you are likely viewing this file using the <code>file</code> protocol which does not support cross origin requests.
<br/><br/>
Use the <code>server</code> script instead:
<br/><br/>
<code>node ./fixtures/devtools/regression/server.js</code><br/>
<code>open <a href="http://localhost:3000/canary.html">http://localhost:3000/canary.html</a></code>
</div>
<script src="shared.js" type="text/babel"></script>
<!--
This is a great way to try React but it's not suitable for production.
It slowly compiles JSX with Babel in the browser and uses a large development build of React.
Learn more at https://reactjs.org/docs/getting-started.html
-->
</body>
</html>

View File

@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>React DevTools regression test</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<iframe src="canary.html"></iframe>
<iframe src="next.html"></iframe>
<iframe src="16.7.html"></iframe>
<iframe src="16.6.html"></iframe>
<iframe src="16.5.html"></iframe>
<iframe src="16.4.html"></iframe>
<iframe src="16.3.html"></iframe>
<iframe src="16.2.html"></iframe>
<iframe src="16.1.html"></iframe>
<iframe src="16.0.html"></iframe>
<iframe src="15.6.html"></iframe>
<iframe src="15.5.html"></iframe>
<iframe src="15.4.html"></iframe>
<iframe src="15.3.html"></iframe>
<iframe src="15.2.html"></iframe>
<iframe src="15.1.html"></iframe>
<iframe src="15.0.html"></iframe>
<iframe src="14.9.html"></iframe>
</body>
</html>

View File

@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>React next</title>
<link rel="stylesheet" href="styles.css" />
<script type="text/javascript">
// Enable DevTools to inspect React inside of an <iframe>
// This must run before React is loaded
__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
</script>
<script src="https://unpkg.com/scheduler@next/umd/scheduler.development.js"></script>
<script src="https://unpkg.com/scheduler@next/umd/scheduler-tracing.development.js"></script>
<script src="https://unpkg.com/react@next/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@next/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/react-cache@next/umd/react-cache.development.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root">
If you are seeing this message, you are likely viewing this file using the <code>file</code> protocol which does not support cross origin requests.
<br/><br/>
Use the <code>server</code> script instead:
<br/><br/>
<code>node ./fixtures/devtools/regression/server.js</code><br/>
<code>open <a href="http://localhost:3000/next.html">http://localhost:3000/next.html</a></code>
</div>
<script src="shared.js" type="text/babel"></script>
<!--
This is a great way to try React but it's not suitable for production.
It slowly compiles JSX with Babel in the browser and uses a large development build of React.
Learn more at https://reactjs.org/docs/getting-started.html
-->
</body>
</html>

View File

@@ -0,0 +1,16 @@
#!/usr/bin/env node
const finalhandler = require('finalhandler');
const http = require('http');
const serveStatic = require('serve-static');
// Serve fixtures folder
const serve = serveStatic(__dirname, {index: 'index.html'});
// Create server
const server = http.createServer(function onRequest(req, res) {
serve(req, res, finalhandler(req, res));
});
// Listen
server.listen(3000);

View File

@@ -0,0 +1,328 @@
/* eslint-disable no-fallthrough, react/react-in-jsx-scope, react/jsx-no-undef */
/* global React ReactCache ReactDOM SchedulerTracing ScheduleTracing */
const apps = [];
const pieces = React.version.split('.');
const major =
pieces[0] === '0' ? parseInt(pieces[1], 10) : parseInt(pieces[0], 10);
const minor =
pieces[0] === '0' ? parseInt(pieces[2], 10) : parseInt(pieces[1], 10);
// Convenience wrapper to organize API features in DevTools.
function Feature({children, label, version}) {
return (
<div className="Feature">
<div className="FeatureHeader">
<code className="FeatureCode">{label}</code>
<small>{version}</small>
</div>
{children}
</div>
);
}
// Simplify interaction tracing for tests below.
let trace = null;
if (typeof SchedulerTracing !== 'undefined') {
trace = SchedulerTracing.unstable_trace;
} else if (typeof ScheduleTracing !== 'undefined') {
trace = ScheduleTracing.unstable_trace;
} else {
trace = (_, __, callback) => callback();
}
// https://github.com/facebook/react/blob/master/CHANGELOG.md
switch (major) {
case 16:
switch (minor) {
case 7:
if (typeof React.useState === 'function') {
// Hooks
function Hooks() {
const [count, setCount] = React.useState(0);
const incrementCount = React.useCallback(
() => setCount(count + 1),
[count]
);
return (
<div>
count: {count}{' '}
<button onClick={incrementCount}>increment</button>
</div>
);
}
apps.push(
<Feature key="Hooks" label="Hooks" version="16.7+">
<Hooks />
</Feature>
);
}
case 6:
// memo
function LabelComponent({label}) {
return <label>{label}</label>;
}
const AnonymousMemoized = React.memo(({label}) => (
<label>{label}</label>
));
const Memoized = React.memo(LabelComponent);
const CustomMemoized = React.memo(LabelComponent);
CustomMemoized.displayName = 'MemoizedLabelFunction';
apps.push(
<Feature key="memo" label="memo" version="16.6+">
<AnonymousMemoized label="AnonymousMemoized" />
<Memoized label="Memoized" />
<CustomMemoized label="CustomMemoized" />
</Feature>
);
// Suspense
const loadResource = ([text, ms]) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(text);
}, ms);
});
};
const getResourceKey = ([text, ms]) => text;
const Resource = ReactCache.unstable_createResource(
loadResource,
getResourceKey
);
class Suspending extends React.Component {
state = {useSuspense: false};
useSuspense = () => this.setState({useSuspense: true});
render() {
if (this.state.useSuspense) {
const text = Resource.read(['loaded', 2000]);
return text;
} else {
return <button onClick={this.useSuspense}>load data</button>;
}
}
}
apps.push(
<Feature key="Suspense" label="Suspense" version="16.6+">
<React.Suspense fallback={<div>loading...</div>}>
<Suspending />
</React.Suspense>
</Feature>
);
// lazy
const LazyWithDefaultProps = React.lazy(
() =>
new Promise(resolve => {
function FooWithDefaultProps(props) {
return (
<h1>
{props.greeting}, {props.name}
</h1>
);
}
FooWithDefaultProps.defaultProps = {
name: 'World',
greeting: 'Bonjour',
};
resolve({
default: FooWithDefaultProps,
});
})
);
apps.push(
<Feature key="lazy" label="lazy" version="16.6+">
<React.Suspense fallback={<div>loading...</div>}>
<LazyWithDefaultProps greeting="Hello" />
</React.Suspense>
</Feature>
);
case 5:
case 4:
// unstable_Profiler
class ProfilerChild extends React.Component {
state = {count: 0};
incrementCount = () =>
this.setState(prevState => ({count: prevState.count + 1}));
render() {
return (
<div>
count: {this.state.count}{' '}
<button onClick={this.incrementCount}>increment</button>
</div>
);
}
}
const onRender = (...args) => {};
const Profiler = React.unstable_Profiler || React.Profiler;
apps.push(
<Feature
key="unstable_Profiler"
label="unstable_Profiler"
version="16.4+">
<Profiler id="count" onRender={onRender}>
<div>
<ProfilerChild />
</div>
</Profiler>
</Feature>
);
case 3:
// createContext()
const LocaleContext = React.createContext();
LocaleContext.displayName = 'LocaleContext';
const ThemeContext = React.createContext();
apps.push(
<Feature key="createContext" label="createContext" version="16.3+">
<ThemeContext.Provider value="blue">
<ThemeContext.Consumer>
{theme => <div>theme: {theme}</div>}
</ThemeContext.Consumer>
</ThemeContext.Provider>
<LocaleContext.Provider value="en-US">
<LocaleContext.Consumer>
{locale => <div>locale: {locale}</div>}
</LocaleContext.Consumer>
</LocaleContext.Provider>
</Feature>
);
// forwardRef()
const AnonymousFunction = React.forwardRef((props, ref) => (
<div ref={ref}>{props.children}</div>
));
const NamedFunction = React.forwardRef(function named(props, ref) {
return <div ref={ref}>{props.children}</div>;
});
const CustomName = React.forwardRef((props, ref) => (
<div ref={ref}>{props.children}</div>
));
CustomName.displayName = 'CustomNameForwardRef';
apps.push(
<Feature key="forwardRef" label="forwardRef" version="16.3+">
<AnonymousFunction>AnonymousFunction</AnonymousFunction>
<NamedFunction>NamedFunction</NamedFunction>
<CustomName>CustomName</CustomName>
</Feature>
);
// StrictMode
class StrictModeChild extends React.Component {
render() {
return 'StrictModeChild';
}
}
apps.push(
<Feature key="StrictMode" label="StrictMode" version="16.3+">
<React.StrictMode>
<StrictModeChild />
</React.StrictMode>
</Feature>
);
// unstable_AsyncMode (later renamed to unstable_ConcurrentMode, then ConcurrentMode)
const ConcurrentMode =
React.ConcurrentMode ||
React.unstable_ConcurrentMode ||
React.unstable_AsyncMode;
apps.push(
<Feature
key="AsyncMode/ConcurrentMode"
label="AsyncMode/ConcurrentMode"
version="16.3+">
<ConcurrentMode>
<div>
unstable_AsyncMode was added in 16.3, renamed to
unstable_ConcurrentMode in 16.5, and then renamed to
ConcurrentMode in 16.7
</div>
</ConcurrentMode>
</Feature>
);
case 2:
// Fragment
apps.push(
<Feature key="Fragment" label="Fragment" version="16.4+">
<React.Fragment>
<div>one</div>
<div>two</div>
</React.Fragment>
</Feature>
);
case 1:
case 0:
default:
break;
}
break;
case 15:
break;
case 14:
break;
default:
break;
}
function Even() {
return <small>(even)</small>;
}
// Simple stateful app shared by all React versions
class SimpleApp extends React.Component {
state = {count: 0};
incrementCount = () => {
const updaterFn = prevState => ({count: prevState.count + 1});
trace('Updating count', performance.now(), () => this.setState(updaterFn));
};
render() {
const {count} = this.state;
return (
<div>
{count % 2 === 0 ? (
<span>
count: {count} <Even />
</span>
) : (
<span>count: {count}</span>
)}{' '}
<button onClick={this.incrementCount}>increment</button>
</div>
);
}
}
apps.push(
<Feature key="Simple stateful app" label="Simple stateful app" version="any">
<SimpleApp />
</Feature>
);
// This component, with the version prop, helps organize DevTools at a glance.
function TopLevelWrapperForDevTools({version}) {
let header = <h1>React {version}</h1>;
if (version.includes('canary')) {
const commitSha = version.match(/.+canary-(.+)/)[1];
header = (
<h1>
React canary{' '}
<a href={`https://github.com/facebook/react/commit/${commitSha}`}>
{commitSha}
</a>
</h1>
);
} else if (version.includes('alpha')) {
header = <h1>React next</h1>;
}
return (
<div>
{header}
{apps}
</div>
);
}
TopLevelWrapperForDevTools.displayName = 'React';
ReactDOM.render(
<TopLevelWrapperForDevTools version={React.version} />,
document.getElementById('root')
);

View File

@@ -0,0 +1,37 @@
body {
font-family: sans-serif;
font-size: 12px;
}
h1 {
margin: 0;
font-size: 20px;
}
h2 {
margin: 1rem 0 0;
}
iframe {
border: 1px solid #ddd;
border-radius: 0.5rem;
}
code {
white-space: nowrap;
}
.Feature {
margin: 1rem 0;
border-bottom: 1px solid #eee;
padding-bottom: 1rem;
}
.FeatureHeader {
font-size: 16px;
margin-bottom: 0.5rem;
}
.FeatureCode {
background-color: #eee;
padding: 0.25rem;
border-radius: 0.25rem;
}

View File

@@ -0,0 +1,313 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>TODO List</title>
<!-- DevTools -->
<script src="http://localhost:8097"></script>
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/immutable@4.0.0-rc.12/dist/immutable.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
<style type="text/css">
.Input {
font-size: 1rem;
padding: 0.25rem;
}
.IconButton {
padding: 0.25rem;
border: none;
background: none;
cursor: pointer;
}
.List {
margin: 0.5rem 0 0;
padding: 0;
}
.ListItem {
list-style-type: none;
}
.Label {
cursor: pointer;
padding: 0.25rem;
color: #555;
}
.Label:hover {
color: #000;
}
.IconButton {
padding: 0.25rem;
border: none;
background: none;
cursor: pointer;
}
</style>
</head>
<body>
<div id="root"></div>
<script type="text/babel">
const { Fragment, useCallback, useState } = React;
function List(props) {
const [newItemText, setNewItemText] = useState("");
const [items, setItems] = useState([
{ id: 1, isComplete: true, text: "First" },
{ id: 2, isComplete: true, text: "Second" },
{ id: 3, isComplete: false, text: "Third" }
]);
const [uid, setUID] = useState(4);
const handleClick = useCallback(() => {
if (newItemText !== "") {
setItems([
...items,
{
id: uid,
isComplete: false,
text: newItemText
}
]);
setUID(uid + 1);
setNewItemText("");
}
}, [newItemText, items, uid]);
const handleKeyPress = useCallback(
event => {
if (event.key === "Enter") {
handleClick();
}
},
[handleClick]
);
const handleChange = useCallback(
event => {
setNewItemText(event.currentTarget.value);
},
[setNewItemText]
);
const removeItem = useCallback(
itemToRemove => setItems(items.filter(item => item !== itemToRemove)),
[items]
);
const toggleItem = useCallback(
itemToToggle => {
const index = items.indexOf(itemToToggle);
setItems(
items
.slice(0, index)
.concat({
...itemToToggle,
isComplete: !itemToToggle.isComplete
})
.concat(items.slice(index + 1))
);
},
[items]
);
return (
<Fragment>
<h1>List</h1>
<input
type="text"
placeholder="New list item..."
className="Input"
value={newItemText}
onChange={handleChange}
onKeyPress={handleKeyPress}
/>
<button
className="IconButton"
disabled={newItemText === ""}
onClick={handleClick}
>
<span role="img" aria-label="Add item">
</span>
</button>
<ul className="List">
{items.map(item => (
<ListItem
key={item.id}
item={item}
removeItem={removeItem}
toggleItem={toggleItem}
/>
))}
</ul>
</Fragment>
);
}
function ListItem({ item, removeItem, toggleItem }) {
const handleDelete = useCallback(() => {
removeItem(item);
}, [item, removeItem]);
const handleToggle = useCallback(() => {
toggleItem(item);
}, [item, toggleItem]);
return (
<li className="ListItem">
<button className="IconButton" onClick={handleDelete}>
🗑
</button>
<label className="Label">
<input
className="Input"
checked={item.isComplete}
onChange={handleToggle}
type="checkbox"
/>{" "}
{item.text}
</label>
</li>
);
}
function SimpleValues() {
return (
<ChildComponent
string="abc"
emptyString=""
number={123}
undefined={undefined}
null={null}
nan={NaN}
infinity={Infinity}
true={true}
false={false}
/>
);
}
class Custom {
_number = 42;
get number() {
return this._number;
}
}
function CustomObject() {
return <ChildComponent customObject={new Custom()} />;
}
const object = {
string: "abc",
longString: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKJLMNOPQRSTUVWXYZ1234567890",
emptyString: "",
number: 123,
boolean: true,
undefined: undefined,
null: null
};
function ObjectProps() {
return (
<ChildComponent
object={{
outer: {
inner: object
}
}}
array={["first", "second", "third"]}
objectInArray={[object]}
arrayInObject={{ array: ["first", "second", "third"] }}
deepObject={{
// Known limitation: we won't go deeper than several levels.
// In the future, we might offer a way to request deeper access on demand.
a: {
b: {
c: {
d: {
e: {
f: {
g: {
h: {
i: {
j: 10
}
}
}
}
}
}
}
}
}
}}
/>
);
}
const set = new Set(['abc', 123]);
const map = new Map([['name', 'Brian'], ['food', 'sushi']]);
const setOfSets = new Set([new Set(['a', 'b', 'c']), new Set([1, 2, 3])]);
const mapOfMaps = new Map([['first', map], ['second', map]]);
const typedArray = Int8Array.from([100, -100, 0]);
const immutable = Immutable.fromJS({
a: [{ hello: 'there' }, 'fixed', true],
b: 123,
c: {
'1': 'xyz',
xyz: 1,
},
});
function UnserializableProps() {
return (
<ChildComponent
map={map}
set={set}
mapOfMaps={mapOfMaps}
setOfSets={setOfSets}
typedArray={typedArray}
immutable={immutable}
/>
);
}
function ChildComponent(props: any) {
return null;
}
function InspectableElements() {
return (
<Fragment>
<SimpleValues />
<ObjectProps />
<UnserializableProps />
<CustomObject />
</Fragment>
);
}
function App() {
return (
<Fragment>
<List />
<InspectableElements />
</Fragment>
);
}
ReactDOM.render(<App />, document.getElementById("root"));
</script>
</body>
</html>

View File

@@ -11,7 +11,7 @@
"classnames": "^2.2.5",
"codemirror": "^5.40.0",
"core-js": "^2.4.1",
"jest-diff": "^24.8.0",
"jest-diff": "^25.1.0",
"prop-types": "^15.6.0",
"query-string": "^4.2.3",
"react": "^15.4.1",

View File

@@ -8,8 +8,9 @@
*/
let React;
let TestUtils;
let DOMAct;
let TestRenderer;
let TestAct;
global.__DEV__ = process.env.NODE_ENV !== 'production';
@@ -19,8 +20,9 @@ describe('unmocked scheduler', () => {
beforeEach(() => {
jest.resetModules();
React = require('react');
TestUtils = require('react-dom/test-utils');
DOMAct = require('react-dom/test-utils').act;
TestRenderer = require('react-test-renderer');
TestAct = TestRenderer.act;
});
it('flushes work only outside the outermost act() corresponding to its own renderer', () => {
@@ -32,8 +34,8 @@ describe('unmocked scheduler', () => {
return null;
}
// in legacy mode, this tests whether an act only flushes its own effects
TestRenderer.act(() => {
TestUtils.act(() => {
TestAct(() => {
DOMAct(() => {
TestRenderer.create(<Effecty />);
});
expect(log).toEqual([]);
@@ -42,8 +44,8 @@ describe('unmocked scheduler', () => {
log = [];
// for doublechecking, we flip it inside out, and assert on the outermost
TestUtils.act(() => {
TestRenderer.act(() => {
DOMAct(() => {
TestAct(() => {
TestRenderer.create(<Effecty />);
});
expect(log).toEqual(['called']);
@@ -59,8 +61,9 @@ describe('mocked scheduler', () => {
require.requireActual('scheduler/unstable_mock')
);
React = require('react');
TestUtils = require('react-dom/test-utils');
DOMAct = require('react-dom/test-utils').act;
TestRenderer = require('react-test-renderer');
TestAct = TestRenderer.act;
});
afterEach(() => {
@@ -76,8 +79,8 @@ describe('mocked scheduler', () => {
return null;
}
// with a mocked scheduler, this tests whether it flushes all work only on the outermost act
TestRenderer.act(() => {
TestUtils.act(() => {
TestAct(() => {
DOMAct(() => {
TestRenderer.create(<Effecty />);
});
expect(log).toEqual([]);
@@ -86,8 +89,8 @@ describe('mocked scheduler', () => {
log = [];
// for doublechecking, we flip it inside out, and assert on the outermost
TestUtils.act(() => {
TestRenderer.act(() => {
DOMAct(() => {
TestAct(() => {
TestRenderer.create(<Effecty />);
});
expect(log).toEqual([]);

View File

@@ -10,13 +10,14 @@
let React;
let ReactDOM;
let ReactART;
let TestUtils;
let ARTSVGMode;
let ARTCurrentMode;
let TestUtils;
let TestRenderer;
let ARTTest;
global.__DEV__ = process.env.NODE_ENV !== 'production';
global.__EXPERIMENTAL__ = process.env.RELEASE_CHANNEL === 'experimental';
expect.extend(require('../toWarnDev'));
@@ -28,10 +29,10 @@ beforeEach(() => {
jest.resetModules();
React = require('react');
ReactDOM = require('react-dom');
TestUtils = require('react-dom/test-utils');
ReactART = require('react-art');
ARTSVGMode = require('art/modes/svg');
ARTCurrentMode = require('art/modes/current');
TestUtils = require('react-dom/test-utils');
TestRenderer = require('react-test-renderer');
ARTCurrentMode.setCurrent(ARTSVGMode);
@@ -70,7 +71,7 @@ beforeEach(() => {
it("doesn't warn when you use the right act + renderer: dom", () => {
TestUtils.act(() => {
TestUtils.renderIntoDocument(<App />);
ReactDOM.render(<App />, document.createElement('div'));
});
});
@@ -98,7 +99,7 @@ it('resets correctly across renderers', () => {
it('warns when using the wrong act version - test + dom: render', () => {
expect(() => {
TestRenderer.act(() => {
TestUtils.renderIntoDocument(<App />);
ReactDOM.render(<App />, document.createElement('div'));
});
}).toWarnDev(["It looks like you're using the wrong act()"], {
withoutStack: true,
@@ -112,12 +113,14 @@ it('warns when using the wrong act version - test + dom: updates', () => {
setCtr = _setCtr;
return ctr;
}
TestUtils.renderIntoDocument(<Counter />);
ReactDOM.render(<Counter />, document.createElement('div'));
expect(() => {
TestRenderer.act(() => {
setCtr(1);
});
}).toWarnDev(["It looks like you're using the wrong act()"]);
}).toWarnDev(["It looks like you're using the wrong act()"], {
withoutStack: true,
});
});
it('warns when using the wrong act version - dom + test: .create()', () => {
@@ -153,12 +156,14 @@ it('warns when using the wrong act version - dom + test: updates', () => {
TestUtils.act(() => {
setCtr(1);
});
}).toWarnDev(["It looks like you're using the wrong act()"]);
}).toWarnDev(["It looks like you're using the wrong act()"], {
withoutStack: true,
});
});
it('does not warn when nesting react-act inside react-dom', () => {
TestUtils.act(() => {
TestUtils.renderIntoDocument(<ARTTest />);
ReactDOM.render(<ARTTest />, document.createElement('div'));
});
});
@@ -176,19 +181,21 @@ it("doesn't warn if you use nested acts from different renderers", () => {
});
});
it('warns when using createRoot() + .render', () => {
const root = ReactDOM.unstable_createRoot(document.createElement('div'));
expect(() => {
TestRenderer.act(() => {
root.render(<App />);
});
}).toWarnDev(
[
'In Concurrent or Sync modes, the "scheduler" module needs to be mocked',
"It looks like you're using the wrong act()",
],
{
withoutStack: true,
}
);
});
if (__EXPERIMENTAL__) {
it('warns when using createRoot() + .render', () => {
const root = ReactDOM.unstable_createRoot(document.createElement('div'));
expect(() => {
TestRenderer.act(() => {
root.render(<App />);
});
}).toWarnDev(
[
'In Concurrent or Sync modes, the "scheduler" module needs to be mocked',
"It looks like you're using the wrong act()",
],
{
withoutStack: true,
}
);
});
}

View File

@@ -71,8 +71,10 @@ class Header extends React.Component {
<option value="/text-inputs">Text Inputs</option>
<option value="/number-inputs">Number Input</option>
<option value="/password-inputs">Password Input</option>
<option value="/email-inputs">Email Input</option>
<option value="/selects">Selects</option>
<option value="/textareas">Textareas</option>
<option value="/progress">Progress</option>
<option value="/input-change-events">
Input change events
</option>
@@ -86,6 +88,7 @@ class Header extends React.Component {
<option value="/mouse-events">Mouse Events</option>
<option value="/selection-events">Selection Events</option>
<option value="/suspense">Suspense</option>
<option value="/form-state">Form State</option>
</select>
</label>
<label htmlFor="global_version">

View File

@@ -55,4 +55,4 @@ class IframeSubtree extends React.Component {
}
}
export default (ReactDOM.createPortal ? IframePortal : IframeSubtree);
export default ReactDOM.createPortal ? IframePortal : IframeSubtree;

View File

@@ -13,7 +13,7 @@ export default class ButtonTestCases extends React.Component {
<FixtureSet title="Buttons">
<TestCase
title="onClick with disabled buttons"
description="The onClick event handler should not be invoked when clicking on a disabled buyaton">
description="The onClick event handler should not be invoked when clicking on a disabled button">
<TestCase.Steps>
<li>Click on the disabled button</li>
</TestCase.Steps>

View File

@@ -0,0 +1,39 @@
import Fixture from '../../Fixture';
const React = window.React;
class EmailDisabledAttributesTestCase extends React.Component {
state = {value: 'a@fb.com'};
onChange = event => {
this.setState({value: event.target.value});
};
render() {
return (
<Fixture>
<div>{this.props.children}</div>
<div className="control-box">
<fieldset>
<legend>Controlled</legend>
<input
type="email"
value={this.state.value}
onChange={this.onChange}
/>
<span className="hint">
{' '}
Value: {JSON.stringify(this.state.value)}
</span>
</fieldset>
<fieldset>
<legend>Uncontrolled</legend>
<input type="email" defaultValue="" />
</fieldset>
</div>
</Fixture>
);
}
}
export default EmailDisabledAttributesTestCase;

View File

@@ -0,0 +1,48 @@
import Fixture from '../../Fixture';
const React = window.React;
class EmailAttributesTestCase extends React.Component {
state = {value: 'a@fb.com'};
onChange = event => {
this.setState({value: event.target.value});
};
render() {
return (
<Fixture>
<div>{this.props.children}</div>
<div className="control-box">
<fieldset>
<legend>Controlled</legend>
<input
type="email"
pattern=".+@fb.com"
maxlength={17}
multiple={true}
value={this.state.value}
onChange={this.onChange}
/>
<span className="hint">
{' '}
Value: {JSON.stringify(this.state.value)}
</span>
</fieldset>
<fieldset>
<legend>Uncontrolled</legend>
<input
type="email"
defaultValue=""
pattern=".+@fb.com"
maxlength={17}
multiple={true}
/>
</fieldset>
</div>
</Fixture>
);
}
}
export default EmailAttributesTestCase;

View File

@@ -0,0 +1,39 @@
import Fixture from '../../Fixture';
const React = window.React;
class JumpingCursorTestCase extends React.Component {
state = {value: ''};
onChange = event => {
this.setState({value: event.target.value});
};
render() {
return (
<Fixture>
<div>{this.props.children}</div>
<div className="control-box">
<fieldset>
<legend>Controlled</legend>
<input
type="email"
value={this.state.value}
onChange={this.onChange}
/>
<span className="hint">
{' '}
Value: {JSON.stringify(this.state.value)}
</span>
</fieldset>
<fieldset>
<legend>Uncontrolled</legend>
<input type="email" defaultValue="" />
</fieldset>
</div>
</Fixture>
);
}
}
export default JumpingCursorTestCase;

View File

@@ -0,0 +1,68 @@
import FixtureSet from '../../FixtureSet';
import TestCase from '../../TestCase';
import JumpingCursorTestCase from './JumpingCursorTestCase';
import EmailEnabledAttributesTestCase from './EmailEnabledAttributesTestCase';
import EmailDisabledAttributesTestCase from './EmailDisabledAttributesTestCase';
const React = window.React;
function EmailInputs() {
return (
<FixtureSet title="Email inputs">
<TestCase
title="Spaces in email inputs"
description={`
Some browsers are trying to remove spaces from email inputs and after
doing this place cursor to the beginning.
`}
affectedBrowsers="Chrome">
<TestCase.Steps>
<li>Type space and character</li>
<li>Type character, space, character, delete last character</li>
</TestCase.Steps>
<TestCase.ExpectedResult>Cursor not moving.</TestCase.ExpectedResult>
<JumpingCursorTestCase />
</TestCase>
<TestCase
title="Attributes enabled"
description={`
Test enabled pattern, maxlength, multiple attributes.
`}>
<TestCase.Steps>
<li>Type after existing text ',b@tt.com'</li>
<li>Try to type spaces after typed text</li>
</TestCase.Steps>
<TestCase.ExpectedResult>
Spaces not added. When cursor hovered over input, popup "Please match
the requested format." is showed.
</TestCase.ExpectedResult>
<EmailEnabledAttributesTestCase />
</TestCase>
<TestCase
title="Attributes disabled"
description={`
Test disabled maxlength, multiple attributes.
`}>
<TestCase.Steps>
<li>Type after existing text ',b@tt.com'</li>
<li>Try to type spaces after typed text</li>
</TestCase.Steps>
<TestCase.ExpectedResult>
Spaces are added freely. When cursor hovered over input, popup "A part
following '@' should not contain the symbol ','." is showed.
</TestCase.ExpectedResult>
<EmailDisabledAttributesTestCase />
</TestCase>
</FixtureSet>
);
}
export default EmailInputs;

View File

@@ -0,0 +1,60 @@
import Fixture from '../../Fixture';
const React = window.React;
class ControlledFormFixture extends React.Component {
constructor(props) {
super(props);
this.state = {name: '', email: ''};
this.handleEmailChange = this.handleEmailChange.bind(this);
this.handleNameChange = this.handleNameChange.bind(this);
}
handleEmailChange(event) {
this.setState({email: event.target.value});
}
handleNameChange(event) {
this.setState({name: event.target.value});
}
render() {
return (
<Fixture>
<form>
<label>
Name:
<input
type="text"
value={this.state.name}
onChange={this.handleNameChange}
name="name"
x-autocompletetype="name"
/>
</label>
<br />
<label>
Email:
<input
type="text"
value={this.state.email}
onChange={this.handleEmailChange}
name="email"
x-autocompletetype="email"
/>
</label>
</form>
<br />
<div>
<span>States</span>
<br />
<span>Name: {this.state.name}</span>
<br />
<span>Email: {this.state.email}</span>
</div>
</Fixture>
);
}
}
export default ControlledFormFixture;

View File

@@ -0,0 +1,60 @@
import FixtureSet from '../../FixtureSet';
import TestCase from '../../TestCase';
import ControlledFormFixture from './ControlledFormFixture';
const React = window.React;
export default class FormStateCases extends React.Component {
render() {
return (
<FixtureSet title="Form State">
<TestCase
title="Form state autofills from browser"
description="Form start should autofill/autocomplete if user has autocomplete/autofill information saved. The user may need to set-up autofill or autocomplete with their specific browser.">
<TestCase.Steps>
<li>
Set up autofill/autocomplete for your browser.
<br />
Instructions:
<ul>
<li>
<SafeLink
href="https://support.google.com/chrome/answer/142893?co=GENIE.Platform%3DDesktop&hl=en"
text="Google Chrome"
/>
</li>
<li>
<SafeLink
href="https://support.mozilla.org/en-US/kb/autofill-logins-firefox"
text="Mozilla FireFox"
/>
</li>
<li>
<SafeLink
href="https://support.microsoft.com/en-us/help/4027718/microsoft-edge-automatically-fill-info"
text="Microsoft Edge"
/>
</li>
</ul>
</li>
<li>Click into any input.</li>
<li>Select any autofill option.</li>
</TestCase.Steps>
<TestCase.ExpectedResult>
Autofill options should appear when clicking into fields. Selected
autofill options should change state (shown underneath, under
"States").
</TestCase.ExpectedResult>
<ControlledFormFixture />
</TestCase>
</FixtureSet>
);
}
}
const SafeLink = ({text, href}) => {
return (
<a target="_blank" rel="noreferrer" href={href}>
{text}
</a>
);
};

View File

@@ -33,7 +33,8 @@ export default function Home() {
<td>
<a href="https://www.mozilla.org/en-US/firefox/organizations/">
ESR<sup></sup>
</a>, Latest
</a>
, Latest
</td>
</tr>
<tr>

View File

@@ -105,7 +105,7 @@ class Hydration extends React.Component {
Version:
<VersionPicker
id="hydration_version"
name="hyration_version"
name="hydration_version"
version={version}
onChange={this.setVersion}
/>

View File

@@ -1,5 +1,6 @@
import FixtureSet from '../../FixtureSet';
import MouseMovement from './mouse-movement';
import MouseEnter from './mouse-enter';
const React = window.React;
@@ -8,6 +9,7 @@ class MouseEvents extends React.Component {
return (
<FixtureSet title="Mouse Events">
<MouseMovement />
<MouseEnter />
</FixtureSet>
);
}

View File

@@ -0,0 +1,73 @@
import TestCase from '../../TestCase';
const React = window.React;
const ReactDOM = window.ReactDOM;
const MouseEnter = () => {
const containerRef = React.useRef();
React.useEffect(function() {
const hostEl = containerRef.current;
ReactDOM.render(<MouseEnterDetect />, hostEl, () => {
ReactDOM.render(<MouseEnterDetect />, hostEl.childNodes[1]);
});
}, []);
return (
<TestCase
title="Mouse Enter"
description=""
affectedBrowsers="Chrome, Safari, Firefox">
<TestCase.Steps>
<li>Mouse enter the boxes below, from different borders</li>
</TestCase.Steps>
<TestCase.ExpectedResult>
Mouse enter call count should equal to 1; <br />
Issue{' '}
<a
rel="noopener noreferrer"
target="_blank"
href="https://github.com/facebook/react/issues/16763">
#16763
</a>{' '}
should not happen.
<br />
</TestCase.ExpectedResult>
<div ref={containerRef} />
</TestCase>
);
};
const MouseEnterDetect = () => {
const [log, setLog] = React.useState({});
const firstEl = React.useRef();
const siblingEl = React.useRef();
const onMouseEnter = e => {
const timeStamp = e.timeStamp;
setLog(log => {
const callCount = 1 + (log.timeStamp === timeStamp ? log.callCount : 0);
return {
timeStamp,
callCount,
};
});
};
return (
<React.Fragment>
<div
ref={firstEl}
onMouseEnter={onMouseEnter}
style={{
border: '1px solid #d9d9d9',
padding: '20px 20px',
}}>
Mouse enter call count: {log.callCount || ''}
</div>
<div ref={siblingEl} />
</React.Fragment>
);
};
export default MouseEnter;

View File

@@ -0,0 +1,87 @@
import Fixture from '../../Fixture';
import FixtureSet from '../../FixtureSet';
import TestCase from '../../TestCase';
const React = window.React;
class ProgressFixture extends React.Component {
state = {value: 0, max: 1, enabled: false, backwards: false};
startTest = () => {
this.setState({enabled: true}, () => {
this.progressIntervalId = setInterval(() => {
if (this.state.backwards) {
if (this.state.value > 0) {
this.setState({value: this.state.value - this.state.max / 100});
} else {
if (this.state.max === 10000) {
this.resetTest();
} else {
this.setState({max: this.state.max * 100, backwards: false});
}
}
} else {
if (this.state.value < this.state.max) {
this.setState({value: this.state.value + this.state.max / 100});
} else {
this.setState({backwards: true});
}
}
}, 10);
});
};
resetTest = () => {
clearInterval(this.progressIntervalId);
this.setState({value: 0, max: 1, enabled: false, backwards: false});
};
render() {
return (
<FixtureSet title="Progress">
<TestCase title="Fill and reset progress bar">
<TestCase.Steps>
<li>Press enable button</li>
</TestCase.Steps>
<TestCase.ExpectedResult>
When enabled, bar value should increase from 0% to 100% and
backwards during three step loop: 0-1, 0-100, 0-10000. Reset button
stops loop, sets value to 0 and max to 1.
</TestCase.ExpectedResult>
<Fixture>
<div className="control-box">
<fieldset>
<legend>Controlled</legend>
<progress
value={this.state.value}
max={this.state.max}></progress>
<button
onClick={
this.state.enabled ? this.resetTest : this.startTest
}>
{this.state.enabled ? 'Reset' : 'Enable'}
</button>
<br />
<span className="hint">
{' '}
max: {JSON.stringify(this.state.max)}
</span>
<span className="hint">
{' '}
value:{' '}
{JSON.stringify(
Math.round((this.state.value + Number.EPSILON) * 100) / 100
)}
</span>
</fieldset>
</div>
</Fixture>
</TestCase>
</FixtureSet>
);
}
}
export default ProgressFixture;

View File

@@ -172,7 +172,7 @@ class SelectFixture extends React.Component {
<option value="monkey">monkey</option>
<option value="lion">lion</option>
<option value="mongoose">mongoose</option>
<option value="tiger">tiget</option>
<option value="tiger">tiger</option>
</select>
</form>
</div>

Some files were not shown because too many files have changed in this diff Show More