Commit Graph

2071 Commits

Author SHA1 Message Date
Laura González 341faaf4e3 fire away 2019-12-06 15:25:07 +00:00
Laura González d84332c4f7 Revert "test this"
This reverts commit fafc2e1889.
2019-12-05 17:11:44 +00:00
Laura González fafc2e1889 test this 2019-12-05 17:02:10 +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 3e77742d8c.
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
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
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
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 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 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
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