Commit Graph

6787 Commits

Author SHA1 Message Date
Sassan Haradji 2debcef8f6 prevent spamming warnings related to performance measurement code (#7299)
* prevent spamming warnings related to performance measurement code

* minor changes in names and such

* -

* -

(cherry picked from commit 1cc9a5dc71)
2016-07-21 14:34:16 -07:00
Dan Abramov 7cdcb4f696 Eagerly evaluate inline requires in Jest (#7245)
* Eagerly evaluate inline requires in Jest

I inlined some requires in #7188 to fix the build size regression.
However this caused an issue with Jest due to it resetting module registry between tests.

This is a temporary fix to #7240.
It should be reverted as part of #7178.

* Make the hack work in all environments

(cherry picked from commit 15ae5857f6)
2016-07-21 14:34:15 -07:00
Dan Abramov 8f8e215df1 Fix TestUtils crash with NODE_ENV=production (#7246)
I caused it with #7189.
We generally don’t recommend running TestUtils in production environment but this is technically a regression.

Fixes #7231.
(cherry picked from commit 27d7592cf6)
2016-07-21 14:34:15 -07:00
Paul O’Shannessy 42d7d0adad 15.3.0-rc.2 2016-07-13 14:03:52 -07:00
Troy DeMonbreun 14e6a69a46 Fix #7099 (#7251)
* Set step prop before value prop

* Embed comments on .step sequence behavior

(cherry picked from commit fc04310792)
2016-07-13 13:54:23 -07:00
Mert Kahyaoğlu b1e1ccf632 Renaming: ReactDOM (#7265)
Rename React with ReactDOM
(cherry picked from commit 2da50a0f18)
2016-07-13 13:54:23 -07:00
Brandon Dail 7b78757c6f Add referrerPolicy to HTMLDOMPropertyConfig (#7274)
(cherry picked from commit cccef3c683)
2016-07-13 13:54:23 -07:00
Brandon Dail 7d3cf9565e Inject default batching after pending transactions (#7033)
(cherry picked from commit b6e1eb2718)
2016-07-13 13:54:22 -07:00
Paul O’Shannessy 86cc1d4e67 15.3.0-rc.1 2016-07-13 11:57:28 -07:00
Paul O’Shannessy 80d09bfbb3 Regenerate error codes 2016-07-13 11:50:57 -07:00
Keyan Zhang 615ae2f497 warn for using maps as children with owner info (#7260)
(cherry picked from commit 5103e1d6a1)
2016-07-13 11:44:10 -07:00
Ben Alpert 1c3b4af564 Test renderer improvements (#7258)
Adds `.update(newElement)` and `.unmount()` and makes children reorders and composite type swapping work.

Part of #7148.
(cherry picked from commit caec8d5ce7)
2016-07-13 11:44:10 -07:00
Ben Alpert 40cc8fa45f Update benchmarks to be more realistic polymorphically (#7255)
Previously, the extract-components script would create the same number of layers of composites as the page it captures, but it would output a new class for each time any composite is used (since we don't want to replicate all the component logic).

I changed the script to output a single type for each type in the input -- and each generated component takes an index for which output it should return. This should be closer to how the original code behaves, especially with respect to VM function call lookups where the amount of polymorphism makes a difference.

I re-recorded the benchmarks with the new scripts. They run significantly faster:

```
Comparing old.txt (control) vs new.txt (test)
Significant differences marked by ***
% change from control to test, with 99% CIs:

* ssr_pe_cold_ms_jsc_jit
    % change: -41.73% [-43.37%, -40.09%]  ***
    means: 39.3191 (control), 22.9127 (test)
* ssr_pe_cold_ms_jsc_nojit
    % change: -44.24% [-46.69%, -41.80%]  ***
    means: 45.8646 (control), 25.5764 (test)
* ssr_pe_cold_ms_node
    % change: -45.61% [-47.38%, -43.85%]  ***
    means: 90.1118 (control), 49.0116 (test)
```

This is probably in part due to the changes here, but also the page I captured has changed somewhat in the meantime and there seem to be slightly fewer components in the hierarchy, so they're not really comparable. But going forward we can use this benchmark which should be more accurate. I also included an identical copy that uses stateless functional components so we can test optimizations to those later.
(cherry picked from commit e5513eceff)
2016-07-13 11:44:09 -07:00
Kent C. Dodds ea61ddb0d0 Add link to video chat with @spicyj (#7252)
(cherry picked from commit 12bc80a6dc)
2016-07-13 11:44:09 -07:00
Usman 9f975293e1 Fixed all eslint warnings (#7230)
(cherry picked from commit c52a2b9ab0)
2016-07-13 11:44:09 -07:00
Samy Al Zahrani d40393fde7 Add xmlns and xmlns:xlink attributes (#6471)
(cherry picked from commit 9a80d42817)
2016-07-13 11:44:09 -07:00
Dan Abramov 8517e99816 Fix unmounting performance regression in V8 (#7232)
As reported in #7227, unmounting performance regressed with React 15.
It seems that `delete` has become much slower since we started using numeric keys.
Forcing dictionary keys to start with a dot fixes the issue.
(cherry picked from commit 64e7602b3b)
2016-07-13 11:44:09 -07:00
Ben Alpert cf07f0cab1 Add React.PureComponent (#7195)
This provides an easy way to indicate that components should only rerender when given new props, like PureRenderMixin. If you rely on mutation in your React components, you can continue to use `React.Component`.

Inheriting from `React.PureComponent` indicates to React that your component doesn't need to rerender when the props are unchanged. We'll compare the old and new props before each render and short-circuit if they're unchanged. It's like an automatic shouldComponentUpdate.
(cherry picked from commit c8fbdac227)
2016-07-13 11:44:09 -07:00
yiminghe ddb58dd9f3 consistent owner for stateless component (#6534)
(cherry picked from commit b11540ccb2)
2016-07-13 11:43:37 -07:00
Brandon Dail 7d9ded56a2 Use hardcoded value for PropType secret (#7194)
Rename secret!
(cherry picked from commit 2c93a41580)
2016-07-13 11:39:40 -07:00
Brandon Dail e75e8dcbeb Warn if PropType function is called manually (#7132)
* Warn if PropType function is called in production

* Check if console is undefined before warning

* Randomize value of ReactPropTypesSecret

* Remove dev environment tests

* Rename typeCheckPass to productionWarningCheck

* Rename productionWarningCheck to expectWarningInProduction

* Call toString on Math.random()

* Rename test block for React type checks

* Make sure warning isnt emitted for failing props

* Cache warning by component and prop, warn in dev

* Pass ReactPropTypesSecret to internal checks

* Move tests to ReactPropTypes-test.js

* Update the warning message to include link

* Do not test warning for unions  with invalid args

(cherry picked from commit 95ac239cf3)
2016-07-13 11:39:40 -07:00
Troy DeMonbreun 4a0a534357 Fix for #5468: Validate PropTypes.oneOf(Type) arguments early (#6316)
* Fix for 5468: Validate proptype definitions sooner

Added typeCheckWarn() func and updated the oneOf/oneOfType tests
Added __DEV__ warning for invalid oneOf/OneOfType args

* Suppress redundant error on warn; typeCheckWarn() removed

* Return no-op

* Using emptyFunction module for consistency

* Remove createChainableTypeChecker() call

* Adjust test to assert type check passes when warned

(cherry picked from commit 6cc037bd0d)
2016-07-13 11:39:40 -07:00
Ben Alpert d441128bf6 Make "unexpected batch number" a warning (#7133)
This was added to catch internal errors in React but doesn't seem to be doing much good except frustrating people more when their apps throw (#6895, FB-internal t11950821). Until more proper error boundaries land, let's make this a warning.
(cherry picked from commit abcd567325)
2016-07-13 11:39:40 -07:00
Dan Abramov 891e087926 Fix tests from #6158 to use Jasmine 2 (#7126)
(cherry picked from commit a49b7a2dfb)
2016-07-13 11:39:40 -07:00
Swaroop SM 9d385ef326 Warn if the included mixin is undefined (#6158)
(cherry picked from commit 18bad0669f)
2016-07-13 11:39:40 -07:00
Evan Jacobs 3b80d4dcd7 [TestUtils] Copy type to nativeEvent in Simulate.<eventName> (#6154)
Although it is unreasonable to set every possible property for
simulated events, `type` is useful for event handlers that are shared
between types and potentially have different behaviors.
(cherry picked from commit 5a20d449f6)
2016-07-13 11:39:39 -07:00
Dan Abramov 343033bf06 Resolve refs in the order of the children (#7101)
* Resolve refs in the order of the children

React makes no guarantees about ref resolution order. Unfortunately, some of the internal Facebook component APIs (specifically, layer dialogs) currently depend on the ref resolution order. Specifically, the assumption is that if the layer dialog is placed as a last child, by the time it mounts or updates, the refs to any previously declared elements have been resolved.

With the current `ReactMultiChild`, this is *usually* the case but not always. Both initial mount and an update of all components satisfy this assumption: by the time a child mounts or updates, the previous children’s refs have been resolved. The one scenario where it isn’t true is when **a new child is mounted during an update**.

In this case, the `mountComponent()` call used to be delayed until `ReactMultiChild` processes the queue. However, this is inconsistent with how updates normally work: unlike mounting, updating and unmounting happens inside `ReactChildReconciler.updateChildren()` loop.

This PR changes the `mountComponent()` to be performed inside `ReactChildReconciler`, just like `receiveComponent()` and `unmountComponent()`, and thus ensures that `attachRef()` calls are enqueued in the order the children were processed, so by the time the next child flushes, the refs of the previous children have been resolved.

This is not ideal and will probably be broken by incremental reconciler in the future. However, since we are trying to get rid of mixins in the internal codebase, and layered components are one of the biggest blockers to that, it’s lesser evil to temporarily make ref resolution order more strict until we have time to fix up the layer APIs to not rely on it, and are able to relax it again (which would be a breaking change).

* Use array instead of object to avoid lookups

(cherry picked from commit 83cbc3e5fb)
2016-07-13 11:39:39 -07:00
Jim b688bb301c Warn if people mutate children. (#7001)
(cherry picked from commit 49238b9440)
2016-07-13 11:39:34 -07:00
Paul O’Shannessy 9138b45e82 Merge branch '15-stable' into 15-dev 2016-07-13 11:12:26 -07:00
Zac Smith 1b7f871819 Remove uneccesary colon (#7238)
Only use a colon after a statement that is a complete sentence, like [Grammer Girl says](http://www.quickanddirtytips.com/education/grammar/colons).
(cherry picked from commit 473097144c)
2016-07-13 11:11:06 -07:00
Varayut Lerdkanlayanawat 52e45997db Reformat event names in Media Events section (#7250)
(cherry picked from commit 45223dc8bf)
2016-07-13 11:11:05 -07:00
Dan Abramov 45547d1c3b Fix typos in “Mixins Considered Harmful” (#7275)
* Fix typos in “Mixins Considered Harmful”

* Use consistent code style
2016-07-13 18:47:19 +01:00
Dan Abramov 0f520b8cc0 Add a new blog post about mixins 2016-07-13 17:42:01 +01:00
Paul O’Shannessy 5478d76271 Merge pull request #7229 from zpao/blog-post-errorcodes
Blog post for error codes
(cherry picked from commit 92492e08b2)
2016-07-11 17:42:17 -07:00
Paul O’Shannessy 57a1ebb809 Fix typo in previous changelog update 2016-07-08 15:53:40 -07:00
Paul O’Shannessy dfb5cc306f Changelog fixes 2016-07-08 15:50:04 -07:00
Paul O’Shannessy ea880f2e2c Update website for 15.2.1 2016-07-08 15:27:35 -07:00
Paul O’Shannessy 68faf9d1b9 15.2.1 v15.2.1 2016-07-08 15:15:02 -07:00
Paul O’Shannessy 5597ca70be Update readme for 15.2.1 2016-07-08 15:12:35 -07:00
Paul O’Shannessy 4b9d48a150 Merge branch '15-dev' into 15-stable 2016-07-08 15:11:36 -07:00
Paul O’Shannessy 6b19617333 changelog for 15.2.1 2016-07-08 15:09:28 -07:00
Keyan Zhang 86d696d933 Fixed PR link
(cherry picked from commit 48ccab788b)
2016-07-08 12:01:13 -07:00
Dan Abramov e685ca9126 Mention @Aweary’s #6933 in 15.2.0 changelog
(cherry picked from commit 4aa860e1bb)
2016-07-08 12:01:08 -07:00
Dan Abramov abaa9a8760 Add link to @troydemonbreun’s contribution
We missed this PR in the changelog
(cherry picked from commit 36734f4d37)
2016-07-08 12:01:01 -07:00
Paul O’Shannessy ebabd2f8cd Rebuild error codes 2016-07-08 11:49:51 -07:00
Paul O’Shannessy c51e8a1523 re-shrinkwrap 2016-07-08 11:46:00 -07:00
Dan Abramov 9fb898943a Make ReactPerf.start() work during reconciliation (#7208)
* Add failing test demonstrating a ReactPerf warning

* Make the failing ReactPerf test more precise

* Make ReactPerf.start() work during reconciliation

* Reorder lifecycle methods for greater clarity

* Fix memory leak

* Error boundaries should not break ReactPerf

* Put onBeginFlush/onEndFlush into transaction wrappers

This looks cleaner even though it is not strictly necessary.
We still call them manually for unmounting because it doesn't have a transaction.

(cherry picked from commit 1a0e3a3215)
2016-07-08 11:01:15 -07:00
saiyagg ccd781d97e Remove duplicate line (#7210)
(cherry picked from commit 21ce27161d)
2016-07-08 10:58:37 -07:00
Andrey Okonetchnikov 9db68fcf5d Do not render name attribute on INPUT if it is not supplied. Closes #7198. (#7199)
(cherry picked from commit 0d892c03da)
2016-07-08 10:58:37 -07:00
Paul O’Shannessy 219e838070 Don't detach value from defaultValue for submit/reset inputs (#7197)
(cherry picked from commit 5c737b9550)
2016-07-08 10:58:37 -07:00