Commit Graph

13569 Commits

Author SHA1 Message Date
Dan Abramov
90d212d326
Fix movementX/Y polyfill with capture events (#19672)
* Fix movementX/Y polyfill with capture events

* Remove unnecesary call for better inlining
2020-08-21 16:55:41 +01:00
6h057
49af88991c
Fix DevTools crash when inspecting document.all (#19619)
* Add html_all_collection type to correct typeof document.all

* process HTMLAllCollection like HTMLElement + fix flow issue

* fix lint

* move flow fix comment

* Make it work with iframes too

* optimize how we get html_all_collection type

* use once Object.prototype.toString.call
2020-08-21 14:31:16 +01:00
Sebastian Markbåge
d6e433899f
Use Global Render Timeout for CPU Suspense (#19643)
* Use Retry lane for resuming CPU suspended work

* Use a global render timeout for CPU suspense heuristics

* Fix profiler test since we're now reading time more often

* Sync to new reconciler

* Test synchronously rerendering should not render more rows
2020-08-20 14:39:29 -07:00
Hemakshi Sachdev
f912186012
Fix: Unspecified error for IE11 (#19530) (#19664) 2020-08-20 21:53:23 +01:00
Brian Vaughn
d5ed78764f
Visually distinguish user timing marks from React events (#19663) 2020-08-20 14:43:40 -04:00
E-Liang Tan
2bea3fb0b8
Import React Concurrent Mode Profiler (#19634)
Co-authored-by: Brian Vaughn <bvaughn@fb.com>
Co-authored-by: Kartik Choudhary <kartikc.918@gmail.com>
2020-08-20 14:06:28 -04:00
E-Liang Tan
c641b611c4
Upgrade all @babel/* packages to fix DevTools builds on newer Node versions (#19647) 2020-08-20 11:47:16 -04:00
Dan Abramov
08e69f65b4
Fix incorrect copy-paste in test (#19657) 2020-08-20 01:47:32 +01:00
Dan Abramov
64ddef44c6
Revert "Remove onScroll bubbling flag (#19535)" (#19655)
This reverts commit e9721e14e4.
2020-08-19 20:54:54 +01:00
Dan Abramov
dd651df05e
Keep onTouchStart, onTouchMove, and onWheel passive (#19654)
* Keep onTouchStart, onTouchMove, and onWheel passive

* Put it behind a feature flag on WWW
2020-08-19 18:42:33 +01:00
Sebastian Silbermann
87b3e2d257
Add flow to SyntheticEvent (#19564)
* Add flow to SyntheticEvent

* Minimal implementation of known and unknown synthetic events

* less casting

* Update EnterLeaveEventPlugin.js

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
2020-08-19 14:16:48 +01:00
Julien Gilli
b8fa09e9e2
provide profiling bundle for react-reconciler (#19559) 2020-08-19 14:11:27 +01:00
Toru Kobayashi
32ca313060
refactor: remove unnecessary return statements (#19625) 2020-08-19 14:10:41 +01:00
Sam Marks
c45a195429
fix: property list values should show whitespace (#19640) 2020-08-19 08:50:46 -04:00
Brian Vaughn
23595ff593
Add missing param to safelyCallDestroy() (#19638) 2020-08-18 12:02:04 -04:00
ᴜɴвʏтᴇ
24f1923b1b
fix: open two same tabs on firefox (#19632)
close #19629
2020-08-18 10:17:00 -04:00
Luna Ruan
ee409ea3b5
change destroy to safelyCallDestroy (#19605)
We use safelyCallDestroy for commitUnmount and passive effects unmounts but we call destroy directly in commitHookEffectListUnmount (AKA layout effects unmounts because we don't use this anywhere else). This PR changes the direct destroy call to safelyCallDestroy for consistency
2020-08-17 17:32:50 -07:00
Brian Vaughn
bcca5a6ca7
Always skip unmounted/unmounting error boundaries (#19627)
The behavior of error boundaries for passive effects that throw during cleanup was recently changed so that React ignores boundaries which are also unmounting in favor of still-mounted boundaries. This commit implements that same behavior for layout effects (useLayoutEffect, componentWillUnmount, and ref-detachment).

The new, skip-unmounting-boundaries behavior is behind a feature flag (`skipUnmountedBoundaries`).
2020-08-17 15:01:06 -04:00
Timothy Yung
1a41a196bc
Append text string to <Text> error message (#19581)
* Append text string to <Text> error message

* Truncate text in <Text> error message

* Regenerate `codes.json`
2020-08-17 10:47:49 -07:00
Jack Works
1287670191
Fix: React cannot render in ShadowRoot (#15894)
* fix: render in shadow root

* fix: flow typing

* Remove types and turn invariant into warning

Co-authored-by: Dan Abramov <dan.abramov@me.com>
2020-08-17 15:47:49 +01:00
Dan Abramov
e4afb2fddf eslint-plugin-react-hooks@4.1.0 2020-08-17 13:31:20 +01:00
Dan Abramov
ced05c46c1
Update CHANGELOG.md 2020-08-17 13:30:16 +01:00
CY Lim
702fad4b1b
refactor fb.me redirect link to reactjs.org/link (#19598)
* refactor fb.me url to reactjs.org/link

* Update ESLintRuleExhaustiveDeps-test.js

* Update ReactDOMServerIntegrationUntrustedURL-test.internal.js

* Update createReactClassIntegration-test.js

* Update ReactDOMServerIntegrationUntrustedURL-test.internal.js

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
2020-08-17 13:25:50 +01:00
Toru Kobayashi
49cd77d24a
fix: leak strict mode with UMD builds (#19614) 2020-08-15 14:42:49 +01:00
Brian Vaughn
ffb749c95e
Improve error boundary handling for unmounted subtrees (#19542)
A passive effect's cleanup function may throw after an unmount. Prior to this commit, such an error would be ignored. (React would not notify any error boundaries.) After this commit, React's behavior varies depending on which reconciler fork is being used.

For the old reconciler, React will call componentDidCatch for the nearest unmounted error boundary (if there is one). If there are no unmounted error boundaries, React will still swallow the error because the return pointer has been disconnected, so the normal error handling logic does not know how to traverse the tree to find the nearest still-mounted ancestor.

For the new reconciler, React will skip any unmounted boundaries and look for a still-mounted boundary. If one is found, it will call getDerivedStateFromError and/or componentDidCatch (depending on the type of boundary).

Tests have been added for both reconciler variants for now.
2020-08-14 16:46:46 -04:00
Brian Vaughn
9b35dd2fcc
Permanently removed component stacks from scheduling profiler data (#19615)
These stacks improve the profiler data but they're expensive to generate and generating them can also cause runtime errors in larger applications (although an exact repro has been hard to nail down). Removing them for now. We can revisit adding them after this profiler has been integrated into the DevTools extension and we can generate them lazily.
2020-08-14 15:21:13 -04:00
Andrew Clark
3f8115cdd1 Remove didTimeout check from work loop
No longer need this, since we have starvation protection in userspace.

This will also allow us to remove the concept from the Scheduler
package, which is nice because `postTask` doesn't currently support it.
2020-08-14 10:45:24 -04:00
Andrew Clark
9abc2785cb Remove wasteful checks from shouldYield
`shouldYield` will currently return `true` if there's a higher priority
task in the Scheduler queue.

Since we yield every 5ms anyway, this doesn't really have any practical
benefit. On the contrary, the extra checks on every `shouldYield` call
are wasteful.
2020-08-14 10:45:11 -04:00
Clay Tercek
fe6d05229f
fix event.relatedTarget fallback logic for firefox (#19607)
* fix event.relatedTarget fallback logic for firefox

* check if relatedTarget is undefined for fallback
2020-08-14 13:05:53 +01:00
Jordan Eldredge
1d5e10f703
[eslint-plugin-react-hooks] Report constant constructions (#19590)
* [eslint-plugin-react-cooks] Report constant constructions

The dependency array passed to a React hook can be thought of as a list of cache keys. On each render, if any dependency is not `===` its previous value, the hook will be rerun. Constructing a new object/array/function/etc directly within your render function means that the value will be referentially unique on each render. If you then use that value as a hook dependency, that hook will get a "cache miss" on every render, making the dependency array useless.

This can be especially dangerous since it can cascade. If a hook such as `useMemo` is rerun on each render, not only are we bypassing the option to avoid potentially expensive work, but the value _returned_ by `useMemo` may end up being referentially unique on each render causing other downstream hooks or memoized components to become deoptimized.

* Fix/remove existing tests

* Don't give an autofix of wrapping object declarations

It may not be safe to just wrap the declaration of an object, since the object may get mutated.

Only offer this autofix for functions which are unlikely to get mutated.

Also, update the message to clarify that the entire construction of the value should get wrapped.

* Handle the long tail of nodes that will be referentially unique

* Catch let/var constant constructions on initial assignment

* Trim trailing whitespace

* Address feedback from @gaearon

* Rename "assignment" to "initialization"

* Add test for a constant construction used in multiple dependency arrays
2020-08-13 20:54:33 +01:00
Sebastian Markbåge
dab0854c5e
Move commit passive unmount/mount to CommitWork (#19599) 2020-08-13 09:17:33 -07:00
Brian Vaughn
c3ee973c56
Fix emoji character displayed in Chrome extension (#19603) 2020-08-13 11:16:35 -04:00
inottn
ccb6c39451
Remove unused argument (#19600) 2020-08-13 15:11:01 +01:00
Andrew Clark
629125555f
[Scheduler] Re-throw unhandled errors (#19595)
Because `postTask` returns a promise, errors inside a `postTask`
callback result in the promise being rejected.

If we don't catch those errors, then the browser will report an
"Unhandled promise rejection" error. This is a confusing message to see
in the console, because the fact that `postTask` is a promise-based API
is an implementation detail from the perspective of the developer.
"Promise rejection" is a red herring.

On the other hand, if we do catch those errors, then we need to report
the error to the user in some other way.

What we really want is the default error reporting behavior that a
normal, non-Promise browser event gets.

So, we'll re-throw inside `setTimeout`.
2020-08-12 20:06:43 -07:00
Pascal Fong Kye
b6e1d08604
DevTools bug fix: Proxied methods should be safely dehydrated for display 2020-08-12 12:15:53 -04:00
Andrew Clark
b8ed6a1aa5
[Scheduler] Call postTask directly (#19551)
This updates the experimental Scheduler postTask build to call postTask
directly, instead of managing our own custom queue and work loop.

We still use a deadline 5ms mechanism to implement `shouldYield`.

The main thing that postTask is currently missing is the continuation
feature — when yielding to the main thread, the yielding task is sent
to the back of the queue, instead of maintaining its position.

While this would be nice to have, even without it, postTask may be good
enough to replace our userspace implementation.

We'll run some tests to see.
2020-08-12 08:39:47 -05:00
Ricky
c8d9b8878a
Speed up yarn cache in circle (#19566) 2020-08-11 14:05:15 -04:00
Dan Abramov
ce37bfad5f
Remove resolutions from test renderer package.json (#19577) 2020-08-10 20:45:12 +01:00
Kartik Choudhary
2704bb5374
Add ReactVersion to SchedulingProfiler render scheduled marks (#19553)
* Add ReactVersion to SchedulingProfiler render scheduled marks

* Move ReactVersion to a new --react-init-* mark

Co-authored-by: E-Liang Tan <eliang@eliangtan.com>
2020-08-10 10:51:25 -04:00
Brian Vaughn
0c52e24cb6
Support inner component _debugOwner in memo (#19556)
* Support inner component _debugOwner in memo

* test with devtool context

* remove memo test

* Merged master; tweaked test and snapshot

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

Co-authored-by: Theodore Han <tqhan317@gmail.com>
2020-08-10 10:49:10 -04:00
Dan Abramov
94c0244bab
Fix double-firing mouseenter (#19571)
* test: Simulate mouseover in browser

* Fix duplicate onMouseEnter event when relatedTarget is a root

* Test leave as well

Co-authored-by: Sebastian Silbermann <silbermann.sebastian@gmail.com>
2020-08-10 15:08:22 +01:00
Dan Abramov
aa99b0b08e Rename test files 2020-08-10 12:58:42 +01:00
Sebastian Silbermann
7f696bd99c
fix: onFocus/onBlur/onBeforeInput have a matching event type (#19561)
* test: Add current behavior for event types of onFocus/onBlur

* fix: onFocus/onBlur have a matching event type

* fix useFocus

* fix: don't compare native event types with react event types

* Add FocusIn/FocusOutEventInterface

* A simpler alternative fix

* Add regression tests

* Always pass React event type and fix beforeinput

Co-authored-by: Dan Abramov <dan.abramov@me.com>
2020-08-10 12:54:10 +01:00
Sebastian Silbermann
7c30fb3b0b
Update outdated lockfile (#19568) 2020-08-10 11:59:37 +01:00
Andrew Clark
0cd9a6de55
Parallelize Jest in CI (#19552)
Uses CircleCI's `parallelism` key to split our test jobs across multiple
processes, like we do for the build job.
2020-08-07 16:32:59 -04:00
Dan Abramov
2d9ec9199c Indent a command 2020-08-07 19:24:49 +01:00
Dan Abramov
db2f229110 Fix command 2020-08-07 19:23:43 +01:00
Dan Abramov
336729856a
Nesting Fixture (#19531)
* Nesting Fixture

* Add README to nesting fixture

* Apply suggestions from code review

Co-authored-by: Ricky <rickhanlonii@gmail.com>

* Fixes

* Add Redux

* Use different versions

* Use Consumer API

* Rename helper

* Write docs

* Update README.md

* Update README.md

Co-authored-by: Rick Hanlon <rickhanlonii@gmail.com>
2020-08-07 02:08:41 +01:00
Brian Vaughn
a63893ff32
Warn about undefined return value for memo and forwardRef (#19550) 2020-08-06 16:12:32 -04:00
Ricky
32ff428687
Add feature flag for setting update lane priority (#19401)
* Add feature flag for setting update lane priority

* Remove second feature flag

* Refactor feature flag locations

* Add missing else
2020-08-06 12:47:32 -04:00