Commit Graph
10520 Commits
Author SHA1 Message Date
Brian VaughnandGitHub 3f246c8122 Publish a local release (canary or stable) to NPM (#14260)
New release scripts.

Learn more at https://github.com/facebook/react/blob/master/scripts/release/README.md
2018-11-23 12:37:18 -08:00
Dan AbramovandGitHub 4d70c31229 Prevent deopts from modifying exports object in stable builds (#14309) 2018-11-23 14:10:57 +00:00
Dan AbramovandGitHub 1769492278 Fix resolution of outer props with React.memo() (#14312)
* Add failing test for defaultProps between lazy() and memo()

* Add another regression test for defaultProps resolution order

* Resolve outer props for MemoComponent
2018-11-22 19:40:42 +00:00
Dan AbramovandGitHub 453ae89d4e Add more test coverage for nested memo() (#14311) 2018-11-22 19:30:56 +00:00
Dan AbramovandGitHub 26c96e2fb3 Use |0 to coerce to number (#14297) 2018-11-22 15:44:00 +00:00
Dan AbramovandGitHub 86522253e2 List ignored types instead of included types in the stack (#14308) 2018-11-22 15:41:29 +00:00
Isaiah NieldsandDan Abramov a76f2eadae fix spelling error: Here's -> Here (#14307)
"Here's" should be changed to "Here" in the given sentence.
2018-11-22 14:47:20 +00:00
Dan AbramovandGitHub 4fc9cdc105 Warn about reassigning this.props (#14277)
* Warn about reassigning this.props

* Improve the warning

* Don't show the spammy bug warning if we suspect it's a component bug
2018-11-20 16:40:01 +00:00
Dan AbramovandGitHub 1b9d9e57b8 Fix support for mixing react-dom/[email protected] and react@<16.6 (#14291) 2018-11-20 13:09:44 +00:00
Sebastian MarkbågeandGitHub 94a7eede4a Remove import * as pattern from the codebase (#14282)
Whenever we do this, Rollup needs to materialize this as an object.
This causes it to also add the Babel compatibility property which is
unnecessary bloat. However, since when we use these, we leak the object
this often also deopts any compiler optimizations.

If we really need an object we should export default an object.

Currently there is an exception for DOMTopLevelEventTypes since
listing out the imports is a PITA and it doesn't escape so it should
get properly inlined. We should probably move to a different pattern
to avoid this for consistency though.
2018-11-19 15:32:54 -08:00
Dan AbramovandGitHub 9e5eaae6c4 Fix SSR useCallback in render phase (#14279) 2018-11-19 20:47:38 +00:00
Dominic GannawayandGitHub 9a90584084 Clear fields on unmount of fiber to avoid memory leak (#14276)
* Clear fields on unmount of fiber to avoid memory leak
2018-11-19 16:09:11 +00:00
Dominic GannawayandGitHub c830bfc901 Revert "Clear memoizedState on unmount of fiber to avoid memory leak (#14218)" (#14275)
This reverts commit dccbac75fd.
2018-11-19 15:24:46 +00:00
Dominic GannawayandGitHub dccbac75fd Clear memoizedState on unmount of fiber to avoid memory leak (#14218)
* Clear properties on unmount of fiber to ensure objects are not retained
2018-11-19 10:58:14 +00:00
Jason MillerandAndrew Clark 051cbfeab5 Reduce scheduler serialization overhead (#14249)
In the process of switching to MessageChannel, it seems the postMessage call was modified to pass `"*"` (originally the target origin value from `window.postMessage`). This actually ends up triggering serialization, whereas passing `undefined` bypasses.

To save some investigation, passing a Number like `0` still incurs serialization overhead - `undefined` has special behavior.
2018-11-16 10:39:27 -08:00
Andrew ClarkandGitHub 334bab9c67 Wrap shorthand CSS property collision warning in feature flag (#14245)
Disables the recently introduced (#14181) warning for shorthand
CSS property collisions by wrapping in a feature flag. Let's hold off
shipping this until at least the next minor.
2018-11-15 13:36:52 -08:00
Jan PöschkoandNathan Hunzaker 56510afd8a Add a checkbox to fixtures UI to choose React production build (#13786)
* Add a checkbox to fixtures UI to choose React production build

* Assign header__label class name to label directly, instead of using a separate span

* center the production checkbox vertically
2018-11-14 15:34:46 -08:00
Andrew Clark 0fad5ab4c0 [scheduler] Remove window.postMessage fallback
Every browser we can about supports MessageChannel. The ones we don't
care about will fallback to the setTimeout implementation.
2018-11-14 14:44:26 -08:00
Andrew ClarkandGitHub 6a3042ac6d [scheduler] Post to MessageChannel instead of window (#14234)
Scheduler needs to schedule a task that fires after paint. To do this,
it currently posts a message event to `window`. This happens on every
frame until the queue is empty. An unfortunate consequence is that every
other message event handler also gets called on every frame; even if
they exit immediately, this adds up to significant per-frame overhead.

Instead, we'll create a MessageChannel and post to that, with a
fallback to the old behavior if MessageChannel does not exist.
2018-11-14 12:02:00 -08:00
Dan AbramovandGitHub 7da0e9d79a Add 16.6.3 Changelog (#14223)
* Add 16.6.3 Changelog

* Remove unreleased fix

* Drop another unreleased fix
2018-11-13 20:32:33 +00:00
Andrew ClarkandDan Abramov a567910164 Update error codes 2018-11-13 20:29:30 +00:00
Brian VaughnandGitHub 6fb3376fc1 Save CI-built node_modules as build artifacts (#14205)
* Store node_modules generated by CI script as an artifact
* NPM pack artifacts before archiving
2018-11-13 11:00:30 -08:00
Dan AbramovandGitHub f9d7965c72 Add regression test for #14188 (#14197) 2018-11-13 11:23:01 +00:00
Maksim MarkelovandDan Abramov 854bd9becb Update Readme (#14176)
Replace core with react, dom-client with react-dom
2018-11-12 16:25:32 +00:00
Sophie AlpertandGitHub 88d09d18c5 Simplify CSS shorthand property warning (#14183)
I figured out a simpler way to do #14181. It does allocate some but I think that's OK. Time complexity might even be better since we avoid the nested loops the old one had.
2018-11-09 16:56:51 -08:00
Sebastian Markbage f0ab28fe75 fix typo 2018-11-09 16:16:25 -08:00
Sebastian MarkbågeandGitHub 5d9dcbe13f Use unique thread ID for each partial render to access Context (#14182)
* BUG: ReactPartialRenderer / New Context polutes mutable global state

The new context API stores the provided values on the shared context instance. When used in a synchronous context, this is not an issue. However when used in an concurrent context this can cause a "push provider" from one react render to have an effect on an unrelated concurrent react render.

I've encountered this bug in production when using renderToNodeStream, which asks ReactPartialRenderer for bytes up to a high water mark before yielding. If two Node Streams are created and read from in parallel, the state of one can polute the other.

I wrote a failing test to illustrate the conditions under which this happens.

I'm also concerned that the experimental concurrent/async React rendering on the client could suffer from the same issue.

* Use unique thread ID for each partial render to access Context

This first adds an allocator that keeps track of a unique ThreadID index
for each currently executing partial renderer. IDs are not just growing
but are reused as streams are destroyed.

This ensures that IDs are kept nice and compact.

This lets us use an "array" for each Context object to store the current
values. The look up for these are fast because they're just looking up
an offset in a tightly packed "array".

I don't use an actual Array object to store the values. Instead, I rely
on that VMs (notably V8) treat storage of numeric index property access
as a separate "elements" allocation.

This lets us avoid an extra indirection.

However, we must ensure that these arrays are not holey to preserve this
feature.

To do that I store the _threadCount on each context (effectively it takes
the place of the .length property on an array).

This lets us first validate that the context has enough slots before we
access the slot. If not, we fill in the slots with the default value.
2018-11-09 15:38:20 -08:00
Sophie AlpertandGitHub d42b02ef58 SimpleMemoComponent should warn if a ref is given (#14178)
Fixes #13964.
2018-11-09 15:29:41 -08:00
Sophie AlpertandGitHub a3c0caaa50 Warn about conflicting style values during updates (#14181)
This is one of the most insidious quirks of React DOM that people run into. Now we warn when we think an update is dangerous.

We still allow rendering `{background, backgroundSize}` with unchanging values, for example. But once you remove either one or change `background` (without changing `backgroundSize` at the same time), that's bad news. So we warn.

Fixes #6348.
2018-11-09 15:21:47 -08:00
Brian VaughnandGitHub 3901d09d61 Renamed outdated schedule/tracing referecnes (#14177) 2018-11-09 12:37:03 -08:00
Andrew Clark 4ebecf3050 ESlint -> ESLint 2018-11-09 10:22:18 -08:00
Sophie AlpertandGitHub 6b16754978 Don't run danger on bad build (#14143)
sizebot comments can be confusing when not based on reality.

If results.json doesn't exist, danger will fail. This is what we want.
2018-11-09 10:21:39 -08:00
HeavenandSophie Alpert 39f4cf0ccd Fix typos (#14124) 2018-11-09 10:17:49 -08:00
Bartosz GordonandSophie Alpert cf40f2cb22 Fix comment typo (#14156) 2018-11-09 10:17:19 -08:00
Andrew Clark 7cecc264fa Add global to ESLint plugin bundle config 2018-11-08 18:49:03 -08:00
Andrew ClarkandGitHub 28747a745f Add fb build of ESLint plugin (#14165) 2018-11-08 18:44:08 -08:00
Alex TaylorandGitHub 2480c47c09 Improved suspense support in ReactDOMServer (#14161) 2018-11-08 18:15:06 -08:00
Andrew ClarkandGitHub bdc71bca6c Remove errant return assignment (#14164)
Oopsie!

This could have been avoided if our types were modeled correctly with
Flow (using a disjoint union).

Fuzz tester didn't catch it because it does not generate cases where
a Suspense component mounts with no children. I'll update it.
2018-11-08 18:13:42 -08:00
Andrew ClarkandGitHub 3d8170d680 Suspense fuzz tester (#14147)
* Don't warn if an unmounted component is pinged

* Suspense fuzz tester

The fuzzer works by generating a random tree of React elements. The tree
two types of custom components:

- A Text component suspends rendering on initial mount for a fuzzy
  duration of time. It may update a fuzzy number of times; each update
  supsends for a fuzzy duration of time.
- A Container component wraps some children. It may remount its children
  a fuzzy number of times, by updating its key.

The tree may also include nested Suspense components.

After this tree is generated, the tester sets a flag to temporarily
disable Text components from suspending. The tree is rendered
synchronously. The output of this render is the expected output.

Then the tester flips the flag back to enable suspending. It renders the
tree again. This time the Text components will suspend for the amount of
time configured by the props. The tester waits until everything has
resolved. The resolved output is then compared to the expected output
generated in the previous step.

Finally, we render once more, but this time in concurrent mode. Once
again, the resolved output is compared to the expected output.

I tested by commenting out various parts of the Suspense implementation
to see if broke in the expected way. I also confirmed that it would have
caught #14133, a recent bug related to deletions.

* When a generated test case fails, log its input

* Moar fuzziness

Adds more fuzziness to the generated tests. Specifcally, introduces
nested Suspense cases, where the fallback of a Suspense component
also suspends.

This flushed out a bug (yay!) whose test case I've hard coded.

* Use seeded random number generator

So if there's a failure, we can bisect.
2018-11-08 17:26:43 -08:00
Andrew ClarkandGitHub 88fa870d24 Don't warn if an unmounted component is pinged (#14158)
* Add failing test for ping on unmounted component

We had a test for this, but not outside of concurrent mode :)

* Don't warn if an unmounted component is pinged
2018-11-08 17:24:32 -08:00
Andrew ClarkandGitHub a6d9d0db46 [Synchronous Suspense] Don't delete children of suspended component (#14157)
Vestigial behavior that should have been removed in #13823.

Found using the Suspense fuzz tester in #14147.
2018-11-08 11:38:38 -08:00
Nathan SchlossandAndrew Clark b1c9b9f12c Adding logger pri (#14155) 2018-11-08 11:30:38 -08:00
Minh NguyenandDan Abramov 58bef64979 Refactor ESLint configuration to enable better IDE integration (#13914)
* Refactor ESLint configuration to enable better IDE integration

* Minor tweaks
2018-11-08 17:56:35 +00:00
Sebastian MarkbågeandGitHub 327f72403c Use Entry in yarn build ... Instead of Label (#14148)
* Parse build script type and package names

This ensures that `yarn build core dom` includes DOM.

It also ensures that spaces like `yarn build "core, dom"` doesn't build EVERYTHING.

* Get rid of label in bundles config

Instead we just use the name from entry using fuzzy search.

There is one special case. If you put in `/index` or `/index.js`.

That allows to build things like `react/index` to only build isomorphic
where as `react` would build everything. Or `react-dom/index` to exclude
the server renderers.

* Instead of matching `/index.js` just append it to the search string

That way things like `yarn build react/` works too.
2018-11-07 20:46:41 -08:00
Brian VaughnandGitHub 75a65dbb6f Invalid actualDuration+treeBaseDuration for hidden+suspended trees (#14065)
* Fixed `treeBaseDuration` by propagating its value from the suspended tree to the Fragment React temporarily wraps around it when showing the fallback UI.
* Fixed `actualDuration` by recording elapsed profiler time in the event of an error.
* Fixed `actualDuration` in concurrent mode by propagating the time spent rendering the suspending component to its parent.

Also updated ReactSuspensePlaceholder-test.internal to cover these new cases.
2018-11-07 15:46:30 -08:00
Brian VaughnandGitHub e61977843c Tag MemoComponent with PerformedWork effectTag for DevTools Profiler (#14141) 2018-11-07 13:56:12 -08:00
Brian VaughnandGitHub 8b3f32e0f0 Release script supports interleaved stable and alpha releases (#14138) 2018-11-07 12:33:13 -08:00
Andrew ClarkandGitHub 79af421c46 [Synchronous Suspense] Reuse deletions from primary tree (#14133)
Fixes a bug where deletion effects in the primary tree were dropped
before entering the second render pass.

Because we no longer reset the effect list after the first render pass,
I've also moved the deletion of the fallback children to the complete
phase, after the tree successfully renders without suspending.

Will need to revisit this heuristic when we implement resuming.
2018-11-07 10:56:57 -08:00
Dominic GannawayandGitHub 61d4dec008 Show deprecated context object warnings usage in ReactDOM server (#14033)
* Applies context object warnings to ReactDOM server
2018-11-07 17:19:38 +00:00
Andrew Clark 530dafaa6d Make react-debug-tools a private package 2018-11-06 18:45:30 -08:00