Commit Graph
10329 Commits
Author SHA1 Message Date
Sophie AlpertandAndrew Clark 31584c9e72 [private] Fix syntax error 2018-10-04 15:17:55 -07:00
Sophie AlpertandAndrew Clark a2a8113222 [private] Disable failing CircleCI steps 2018-10-04 15:17:55 -07:00
Sophie AlpertandAndrew Clark f92286b833 [private] Disable parallelism on Circle 2018-10-04 15:17:55 -07:00
Sophie AlpertandGitHub d83601080a Wrap retrySuspendedRoot using SchedulerTracing (#13776)
Previously, we were emptying root.pendingInteractionMap and permanently losing those interactions when applying an unrelated update to a tree that has no scheduled work that is waiting on promise resolution. (That is, one that is showing a fallback and waiting for the suspended content to resolve.)

The logic I'm leaving untouched with `nextRenderIncludesTimedOutPlaceholder` is *not* correct -- what we want is instead to know if *any* placeholder anywhere in the tree is showing its fallback -- but we don't currently have a better replacement, and this should unblock tracing with suspense again.
2018-10-04 15:11:12 -07:00
Dan AbramovandGitHub 40a521aa72 Terminology: Functional -> Function Component (#13775)
* Terminology: Functional -> Function Component

* Drop the "stateless" (functions are already stateless, right?)
2018-10-04 22:44:46 +01:00
Michael RidgwayandAndrew Clark 605ab10a4a Add envify transform to scheduler package (#13766)
This package uses `process.env.NODE_ENV` but does not transform its usage during bundling like the rest of the React libraries do. This causes issues when `process` is not defined globally.
2018-10-04 14:18:19 -07:00
Andrew ClarkandGitHub acc7f404ce Restart from root if promise pings before end of render phase (#13774)
* Restart from root if promise pings before end of render phase

* Test that placeholder resolves successfully even if fallback render is pending
2018-10-04 12:55:52 -07:00
Spencer DaviesandSophie Alpert cbc2240288 fix - small misspelling (#13768)
longer term needs a hyphen.
2018-10-04 04:05:51 -04:00
Andrew Clark 4eabeef11b Rename ReactSuspenseWithTestRenderer-test -> ReactSuspense-test 2018-10-03 18:54:38 -06:00
Andrew Clark 95a3e1c2e7 Rename ReactSuspense-test -> ReactSuspenseWithNoopRenderer-test
Doing this in its own commit to preserve history
2018-10-03 18:52:56 -06:00
Andrew ClarkandGitHub 96bcae9d50 Jest + test renderer helpers for concurrent mode (#13751)
* Jest + test renderer helpers for concurrent mode

Most of our concurrent React tests use the noop renderer. But most
of those tests don't test the renderer API, and could instead be
written with the test renderer. We should switch to using the test
renderer whenever possible, because that's what we expect product devs
and library authors to do. If test renderer is sufficient for writing
most React core tests, it should be sufficient for others, too. (The
converse isn't true but we should aim to dogfood test renderer as much
as possible.)

This PR adds a new package, jest-react (thanks @cpojer). I've moved
our existing Jest matchers into that package and added some new ones.

I'm not expecting to figure out the final API in this PR. My goal is
to land something good enough that we can start dogfooding in www.

TODO: Continue migrating Suspense tests, decide on better API names

* Add additional invariants to prevent common errors

- Errors if user attempts to flush when log of yields is not empty
- Throws if argument passed to toClearYields is not ReactTestRenderer

* Better method names

- toFlushAll -> toFlushAndYield
- toFlushAndYieldThrough ->
- toClearYields -> toHaveYielded

Also added toFlushWithoutYielding

* Fix jest-react exports

* Tweak README
2018-10-03 18:37:41 -06:00
HeavenandAndrew Clark 5c783ee751 Remove unreachable code (#13762) 2018-10-03 18:03:01 -06:00
Brian VaughnandGitHub 36c5d69caa Always warn about legacy context within StrictMode tree (#13760) 2018-10-03 08:40:45 -07:00
Maksim MarkelovandDan Abramov 3e9a5de888 UMD react-cache build (#13761) 2018-10-03 15:09:17 +01:00
Andrew Clark 3c60f32747 Fix simple-cache-provider import that I missed 2018-10-02 00:50:33 -06:00
Joe CortopassiandDan Abramov 8315a30b9b --save is no longer needed (#13756)
`--save` is on by default as of [npm 5](https://blog.npmjs.org/post/161081169345/v500), and `npm install aphrodite` is functionally equivalent to `npm install --save aphrodite` now
2018-10-01 19:15:11 +01:00
Andrew ClarkandGitHub ce96e2df4d Rename simple-cache-provider to react-cache (#13755) 2018-10-01 09:07:40 -06:00
Brian VaughnandGitHub c5212646f8 Removed extra typeof checks for contextType.unstable_read (#13736) 2018-09-28 13:12:26 -07:00
Brian VaughnandGitHub 806eebdaee Enable getDerivedStateFromError (#13746)
* Removed the enableGetDerivedStateFromCatch feature flag (aka permanently enabled the feature)
* Forked/copied ReactErrorBoundaries to ReactLegacyErrorBoundaries for testing componentDidCatch
* Updated error boundaries tests to apply to getDerivedStateFromCatch
* Renamed getDerivedStateFromCatch -> getDerivedStateFromError
* Warn if boundary with only componentDidCatch swallows error
* Fixed a subtle reconciliation bug with render phase error boundary
2018-09-28 13:05:01 -07:00
a0733fe13d pure (#13748)
* pure

A higher-order component version of the `React.PureComponent` class.
During an update, the previous props are compared to the new props. If
they are the same, React will skip rendering the component and
its children.

Unlike userspace implementations, `pure` will not add an additional
fiber to the tree.

The first argument must be a functional component; it does not work
with classes.

`pure` uses shallow comparison by default, like `React.PureComponent`.
A custom comparison can be passed as the second argument.

Co-authored-by: Andrew Clark <acdlite@fb.com>
Co-authored-by: Sophie Alpert <sophiebits@fb.com>

* Warn if first argument is not a functional component
2018-09-27 15:25:38 -07:00
Andrew Clark 4d17c3f051 [scheduler] Improve naive fallback version used in non-DOM environments
Added some tests for the non-DOM version of Scheduler that is used
as a fallback, e.g. Jest. The tests use Jest's fake timers API:

- `jest.runAllTimers(ms)` flushes all scheduled work, as expected
- `jest.advanceTimersByTime(ms)` flushes only callbacks that expire
within the given milliseconds.

These capabilities should be sufficient for most product tests. Because
jest's fake timers do not override performance.now or Date.now, we
assume time is constant. This means Scheduler's internal time will not
be aligned with other code that reads from `performance.now`. For finer
control, the user can override `window._sched` like we do in our tests.
We will likely publish a Jest package that has this built in.
2018-09-26 20:25:21 -07:00
Timothy YungandGitHub 469005d87b Revise AttributeType React Native Flow Type (#13737) 2018-09-26 14:40:57 -07:00
Dominic GannawayandGitHub 0dc0ddc1ef Rename AsyncMode -> ConcurrentMode (#13732)
* Rename AsyncMode -> ConcurrentMode
2018-09-26 17:13:02 +01:00
Dominic GannawayandGitHub 7601c37654 Ensure "addEventListener" exists on "window" for "scheduler" package (#13731)
* Ensure addEventListener exists on "window"
2018-09-26 13:38:56 +01:00
Brian VaughnandGitHub d0c0ec98ef Added a PureComponent contextType test (#13729) 2018-09-25 17:28:33 -07:00
Brian VaughnandGitHub 4b68a6498b Support class component static contextType attribute (#13728)
* Support class component static contextType attribute
2018-09-25 15:49:46 -07:00
Andrew ClarkandGitHub f305d2a489 [scheduler] Priority levels, continuations, and wrapped callbacks (#13720)
All of these features are based on features of React's internal
scheduler. The eventual goal is to lift as much as possible out of the
React internals into the Scheduler package.

Includes some renaming of existing methods.

- `scheduleWork` is now `scheduleCallback`
- `cancelScheduledWork` is now `cancelCallback`


Priority levels
---------------

Adds the ability to schedule callbacks at different priority levels.
The current levels are (final names TBD):

- Immediate priority. Fires at the end of the outermost currently
executing (similar to a microtask).
- Interactive priority. Fires within a few hundred milliseconds. This
should only be used to provide quick feedback to the user as a result
of an interaction.
- Normal priority. This is the default. Fires within several seconds.
- "Maybe" priority. Only fires if there's nothing else to do. Used for
prerendering or warming a cache.

The priority is changed using `runWithPriority`:

```js
runWithPriority(InteractivePriority, () => {
  scheduleCallback(callback);
});
```


Continuations
-------------

Adds the ability for a callback to yield without losing its place
in the queue, by returning a continuation. The continuation will have
the same expiration as the callback that yielded.


Wrapped callbacks
-----------------

Adds the ability to wrap a callback so that, when it is called, it
receives the priority of the current execution context.
2018-09-25 15:11:42 -07:00
Brian NgandDan Abramov 970a34baed Bump babel-eslint and remove flow supressions (#13727) 2018-09-25 22:48:31 +01:00
Brian VaughnandGitHub 13965b4d30 Interaction tracking ref-counting bug fixes (WIP) (#13590)
* Added new (failing) suspense+interaction tests
* Add new tracing+suspense test harness fixture
* Refactored interaction tracing to fix ref counting bug
2018-09-25 09:27:41 -07:00
Sergei StartsevandDan Abramov 17e703cb96 Restore global window.event after event dispatching (#13688) (#13697) 2018-09-25 16:24:23 +01:00
HeavenandAndrew Clark a775a767a1 Remove redundant logic (#13502) 2018-09-24 17:59:29 -07:00
PhilippandGitHub 2c7b78f216 Add closing parenthesis (#13712)
I’ve first seen it in the [releases view](https://github.com/facebook/react/releases/tag/v16.5.2) and fixed it there as well.
2018-09-23 12:36:47 +02:00
Maksim MarkelovandDan Abramov e1a067dea0 Fix circular dependency in TracingSubscriptions (#13689) 2018-09-19 18:48:32 +01:00
HeavenandDan Abramov 518812eeb8 Clarify comment (#13684)
* fix comment typo

* Update Scheduler.js
2018-09-19 13:14:32 +01:00
Dan eeb817785c Remove some old files from stats 2018-09-19 01:36:31 +01:00
Dan AbramovandGitHub 7ea3ca1d13 Rename schedule to scheduler (#13683) 2018-09-19 01:26:28 +01:00
Brian Vaughn 9b70816642 Added another bullet to the CHANGELOG 2018-09-18 12:45:31 -07:00
Brian Vaughn db9d51b65c Rename 'Schedule' header -> 'Schedule (Experimental)' 2018-09-18 12:41:14 -07:00
Brian Vaughn 0823f845cf 16.5.2 CHANGELOG 2018-09-18 12:39:32 -07:00
Brian Vaughn bec2ddaf15 Update bundle sizes for 16.5.2 release v16.5.2 2018-09-18 11:30:50 -07:00
Brian Vaughn 789e714bd7 Update error codes for 16.5.2 release 2018-09-18 11:30:50 -07:00
Brian Vaughn 4269fafb0a Updating package versions for release 16.5.2 2018-09-18 11:24:33 -07:00
Brian Vaughn 4380f9ba17 Revert "Updating package versions for release 16.6.0-alpha.0"
This reverts commit 351c9015c8.
2018-09-18 11:00:13 -07:00
Brian Vaughn 72fad84e76 Revert "Updating dependencies for react-noop-renderer"
This reverts commit 489614c4fc.
2018-09-18 11:00:09 -07:00
Brian Vaughn 39f93f7987 Revert "Update error codes for 16.6.0-alpha.0 release"
This reverts commit 21ceb19ea0.
2018-09-18 11:00:04 -07:00
Brian Vaughn c3fad5acf8 Revert "Update bundle sizes for 16.6.0-alpha.0 release"
This reverts commit 42d12317a7.
2018-09-18 10:59:57 -07:00
HeavenandNathan Hunzaker dd91205617 Kepp calling peformWork consistent (#13596) 2018-09-18 07:48:18 -07:00
Brian Vaughn 42d12317a7 Update bundle sizes for 16.6.0-alpha.0 release v16.6.0-alpha.0 2018-09-17 15:05:46 -07:00
Brian Vaughn 21ceb19ea0 Update error codes for 16.6.0-alpha.0 release 2018-09-17 15:05:46 -07:00
Brian Vaughn 489614c4fc Updating dependencies for react-noop-renderer 2018-09-17 14:59:57 -07:00