Commit Graph

11119 Commits

Author SHA1 Message Date
Andrew Clark
29b4559635
.watchmanconfig must be valid json (#16118)
faceworldproblems?
2019-07-11 19:01:02 -07:00
Nicolas Gallagher
ca4d78f9b6
[Flare] Press: fix middle-click handling (#16114)
Make sure the root events are removed after middle-click completes
2019-07-11 22:12:10 +01:00
Sunil Pai
3f1dee09a4
expose act() sigil correctly for umd builds (#16110)
after https://github.com/facebook/react/pull/16039, act was broken for umd builds. This PR fixes it.
2019-07-11 14:56:03 +01:00
Sebastian Markbåge
b7669044d9
Use Map instead of object as map in ReactNativeComponentTree (#16107)
Real Maps should now be used in RN JS engines. In theory this should
be faster (but might not actually be in practice), and it avoids hitting
upper bounds of property max counts.

We don't use these types of Maps in Fabric.
2019-07-10 19:11:36 -07:00
Andrew Clark
d2d9b1f701
[Scheduler] Support inferring priority from stack (#16105)
When executing a task, wraps the callback in an extra function whose
name includes the current priority level. Profiling tools with access
to function names can use this to determine the priority of the task.
2019-07-10 18:59:44 -07:00
Sebastian Markbåge
48f6594474
Add warning when single item or nested arrays are used with SuspenseList (#16094) 2019-07-10 11:07:28 -07:00
Nicolas Gallagher
2073a7144e
[Flare] Press includes button type (#16100)
1. Allow auxillary button clicks (i.e., middle mouse button) to trigger 'onPressStart' and 'onPressEnd', but never 'onPress'.
2. Report the button type – 'primary' or 'auxillary' – on the press event.
2019-07-10 17:52:10 +01:00
Dominic Gannaway
23b8a25345
[Flare] Remove responder flags to simplify logic (#16084) 2019-07-09 15:05:45 +01:00
Eli White
8533c0a168
[Fabric] Add dispatchCommand to React Native renderers (#16085)
* Add dispatchCommand to the public export of the React Native renderers

* Fixup invalid check

* Prettier

* Prettier
2019-07-08 13:03:57 -07:00
Dominic Gannaway
2253bc81d0
[Flare] Switch from currentTarget model to responderTarget model (#16082) 2019-07-08 17:03:15 +01:00
Dominic Gannaway
67e3f3fb6e
[Flare] Revise responder event types (#16081) 2019-07-08 14:35:59 +01:00
Min ho Kim
2a0f6390ed Fix typos (#16076) 2019-07-08 11:51:29 +01:00
Dominic Gannaway
aa519c17cc
[Flare] Add currentTarget and unify RN and DOM codepaths (#16066) 2019-07-08 11:50:21 +01:00
fnll
35d2b3bb5e fix spelling error: resoltion -> resolution (#16055) 2019-07-05 16:08:13 +01:00
Vincent Riemer
bd72b04939 [Flare] Clear pressStart timeout on pointercancel (#16067) 2019-07-05 11:45:33 +01:00
Dominic Gannaway
c40075a72c
[Flare] Remove capture phase Flare events (#16054) 2019-07-04 21:30:46 +01:00
Dominic Gannaway
786186c692
[Flare] createInitialState -> getInitialState (#16051) 2019-07-04 18:06:18 +01:00
Dominic Gannaway
c64f40d718
[Flare] Remove dead event target code (#16063) 2019-07-04 13:10:55 +01:00
Dominic Gannaway
e6bfa327da
[Flare] Cleanup ReactFiberEvents-test (#16047) 2019-07-03 11:31:06 +01:00
Dominic Gannaway
b365ee2816
[Fire] Remove unused React fire fork (#16046) 2019-07-03 11:05:28 +01:00
Sunil Pai
b8f91e6649
[fail] reset IsThisRendererActing correctly (#16042)
* [fail] reset IsThisRendererActing correctly

I missed this in https://github.com/facebook/react/pull/16039. I'd pointed at the wrong previous state, corrupting it in further use. This PR fixes that, and adds a test to make sure it doesn't happen again.

* warn for unacted effects only in strict mode
2019-07-03 03:04:22 +01:00
Sunil Pai
bd846459d6
[fail] Only warn on unacted effects for strict / non sync modes (#16041)
* only warn on unacted effects for strict / non sync modes

(basically, when `fiber.mode !== 0b0000`)

Warnings on unacted effects may be too noisy, especially for legacy apps. This PR fires the warning only when in a non sync mode (concurrent/batched), or when in strict mode. This should make updating easier.

I also added batched mode tests to the act() suite.

* explicitly check for modes before warning, explicit tests for all modes
2019-07-03 01:29:45 +01:00
Dominic Gannaway
6b946ad9da
[Flare] Add more functionality to Scroll event resonder (#16036) 2019-07-02 23:51:31 +01:00
Sunil Pai
a457e02ae3
allow nested act()s from different renderers (#16039)
* allow nested `act()`s from different renderers

There are usecases where multiple renderers need to oprate inside an act() scope
- ReactDOM.render being used inside another component tree. The parent component will be rendered using ReactTestRenderer.create for a snapshot test or something.
- a ReactDOM instance interacting with a ReactTestRenderer instance (like for the new devtools)

This PR changes the way the acting sigils operate to allow for this. It keeps 2 booleans, one attached to React, one attached to the renderer. act() changes these values, and the workloop reads them to decide what warning to trigger.

I also renamed shouldWarnUnactedUpdates to warnsIfNotActing

* s/ReactIsActing/IsSomeRendererActing and s/ReactRendererIsActing/IsThisRendererActing
2019-07-02 22:20:17 +01:00
Anton Korzunov
a865e4a642 Clone a custom hook node before use (#16019) 2019-07-02 17:54:10 +01:00
Dominic Gannaway
6cf2234a57
[Flare] Do not block mouse presses on scroll (#16033) 2019-07-02 16:58:46 +01:00
Sebastian Markbåge
5cb8f6f344
Add tail="collapsed" option to SuspenseList (#16007)
* Add tail="collapsed" option

* Fix issue with tail exceeding the CPU time limit

We used to assume that this didn't suspend but this branch happens in
both cases. This fixes it so that we first check if we suspended.

Now we can fix the tail so that it always render an additional fallback
in this scenario.
2019-07-01 19:56:34 -07:00
lunaruan
46bd11ac3e Flush sync bug (#16027)
* added flush sync test

* added code to run flushSync with ImmediatePriority

* added code to run flushSync with ImmediatePriority

* fixed flow error

* fixed flow error
2019-07-01 16:58:04 -07:00
Sebastian Markbåge
933c664ad6
SuspenseList Optimizations (#16005)
* Add a bunch of optimizations to SuspenseList

We now are able to bail out of reconciliation and splitting out the tail
during deep updates that hasn't changed the child props. This only
works while the list wasn't suspended before.

I also moved the second render of the "head" to the complete phase. This
cleans it up a bit for the tail collapsing PR.

For this second pass I also use a new technique of resetting the child
Fibers for the second pass. This is effectively a fast path to avoid
reconciling the children against props again.

* Move to didSuspend from SuspenseListState to the effectTag

The effectTag now tracks whether the previous commit was suspended.

This frees up SuspenseListState to be render-phase only state.

We use null to mean the default "independent" mode.

* Rename to SuspenseListState to SuspenseListRenderState

* Reuse SuspenseListRenderState across render passes

* Add optimization to bail out of scanning children if they can't be suspended

This optimized the deep update case or initial render without anything
suspending.

We have some information available to us that tell us if nothing has
suspended in the past and nothing has suspended this render pass.

This also fixes a bug where we didn't tag the previous render as having
suspended boundaries if we didn't need to force a rerender.

* rm printChildren

oops
2019-07-01 14:25:07 -07:00
Heaven
fbbbea16e1 fix word async -> concurrent (#15844) 2019-07-01 17:32:29 +01:00
Dominic Gannaway
eb2ace1281
[Flare] Bring Flare support to React Native Fabric (#15887) 2019-06-28 01:22:32 +01:00
Dominic Gannaway
9b0bd43550
[Flare] Re-label Flare flag (#16014) 2019-06-28 01:11:11 +01:00
Dominic Gannaway
8b88ac2592
[Flare] Remove event targets including TouchHitTarget (#16011) 2019-06-27 23:58:48 +01:00
Dan Abramov
f11540926d
Handle changes at module boundaries (#16002) 2019-06-27 20:53:03 +01:00
Benedikt Meurer
915dfe6977 Slightly improve performance of hydration. (#15998)
* Slightly improve performance of hydration.

Avoid loading nodeType and data couple times from the same node in a row,
but instead load them only once, which will help engines to run this code
faster, especially during startup of the application. The general approach
is still not ideal, since hydrating this way forces the browser engine
to materialize JavaScript wrapper objects for all DOM nodes, even if they
are not interesting to hydration itself.

* Fix condition for COMMENT_NODEs.

* Improve general code readability
2019-06-27 07:23:14 -07:00
Dominic Gannaway
824e9bec7a
[Flare] Fix issues with touch + pointer interactions (#15997) 2019-06-26 22:25:49 +01:00
Dominic Gannaway
dd93357aa0
[Flare] Move click handling back into target phase (#15993) 2019-06-26 20:44:44 +01:00
Andrew Clark
4d307de458
Prefix mock Scheduler APIs with _unstable (#15999)
For now this is only meant to be consumed via `act`.
2019-06-26 12:16:08 -07:00
Brandon Dail
9b55bcfc6b [Flare] Add Hooks to event modules (#15953) 2019-06-26 08:47:21 +01:00
Ricky
20da1dae4b Fix error logging in getDerivedStateFromProps (#15797)
* Fix error logging in getDerivedStateFromProps

* Update tests, don't log for both error boundary methods

* Re-add change lost in rebase
2019-06-25 18:02:27 +01:00
Dominic Gannaway
6088a201e1
[Flare] Fix Press scroll cancellation handling (#15983) 2019-06-25 14:31:48 +01:00
Dominic Gannaway
fd601fb219
[Flare] Move all event responders to dom directory (#15981) 2019-06-25 09:32:20 +01:00
Veniamin Krol
827cbc4d00 Rename StatelessComponent to FunctionComponent in react-is/README.md (#15963) 2019-06-24 16:21:58 -07:00
Dan Abramov
d48db594ec eslint-plugin-react-hooks@1.6.1 2019-06-24 22:31:14 +01:00
Thomas Broyer
7439b48cf4 Add explicit support for ESLint 6.0.0 (#15974)
Preemptively update tests wrt 'parser' requiring an absolute
path rather than a package name, even though the project is
still using ESLint 4.

Fixes #15971
2019-06-24 22:30:12 +01:00
Sunil Pai
fce15f14d3
don't fire missing act() warnings for react-art (#15975)
* use toWarnDev for dom fixture tests

forks toWarnDev from root into fixture/dom, updates tes tests to use it

* disable act() warnings for react-art()

- For 'secondary' renderers like react-act, we don't want to fire missing act() warnings; the wrapping renderer will fire warnings anyway, and when it flushes, it flushes effects *across* renderers.

- I could have used isPrimaryRenderer as the flag, but this is marked as false for react-test-renderer, and we *do* want the warning to fire for it. Hence a new flag.

* add missing dependency `art` to fixtures/dom
2019-06-24 19:18:26 +01:00
Dominic Gannaway
20f3546963
[Flare] Ensure Press event hook does not execute side-effects (#15976) 2019-06-24 18:31:49 +01:00
Dan Abramov
d420d2ccb6
[Fresh] Retry failed roots on refresh (#15966)
* Retry failed roots on refresh

* Don't prevent retry after error -> render(null) special case

The check wasn't very resilient because in Concurrent Mode it looks like we can get further follow-up commits even if we captured an error. So we can't reliably distinguish the case where after an error you _manually_ rendered null.

Retrying on an edit after a tree failed _and_ you rendered null in the same tree seems fine. It's also very unlikely a pattern like this actually exists in the wild.
2019-06-24 16:54:54 +01:00
Sunil Pai
04b77c6304
followup to #15763, fix failing test in ReactDOMTracing-test (#15972)
* followup to #15763, failing tests in ReactDOMTracing-test

It was me. I broke the build.

* [ignore] add a newline to trigger a build
2019-06-24 11:44:37 +01:00
Sunil Pai
e1c5e8720d
warn if passive effects get queued outside of an act() call. (#15763)
* warn if passive effects get queued outside of an act() call

While the code itself isn't much (it adds the warning to mountEffect() and updateEffect() in ReactFiberHooks), it does change a lot of our tests. We follow a bad-ish pattern here, which is doing asserts inside act() scopes, but it makes sense for *us* because we're testing intermediate states, and we're manually flush/yield what we need in these tests.

This commit has one last failing test. Working on it.

* pass lint

* pass failing test, fixes another

- a test was failing in ReactDOMServerIntegrationHooks while testing an effect; the behaviour of yields was different from browser and server when wrapped with act(). further, because of how we initialized modules, act() around renders wasn't working corrrectly. solved by passing in ReactTestUtils in initModules, and checking on the finally yielded values in the specific test.
- in ReactUpdates, while testing an infinite recursion detection, the test needed to be wrapped in an act(), which would have caused the recusrsion error to throw. solived by rethrowing the error from inside the act().

* pass ReactDOMServerSuspense

* stray todo

* a better message, consistent with the state update one.
2019-06-24 11:18:24 +01:00