Commit Graph

110 Commits

Author SHA1 Message Date
Josh Perez 28e51005dc Shares debugID information across modules (#8097)
Prior to this, React was using a nextDebugID variable that was locally
scoped to both `instantiateReactComponent` and `ReactShallowRenderer`.
This caused problems when the debugIDs would collide, the `itemMap` in
`ReactComponentTreeHook` would be overwritten and tests would fail
with the message "Expected onBeforeMountComponent() parent and
onSetChildren() to be consistent".

This change shares the debugID with both modules thus preventing any
collisions in the future.
(cherry picked from commit 6eebed0535)
2016-11-16 12:07:24 +00:00
Christopher Chedeau 26d060797c I wrote it live! (#7663)
(cherry picked from commit 334b8bdf16)
2016-10-03 17:57:02 -07:00
Ben Alpert bef7ae4800 Merge pull request #7634 from spicyj/flowfix
Small flow fixes
(cherry picked from commit 0c62d121c5)
2016-10-03 17:33:02 -07:00
Christopher Chedeau 577818e419 Type PooledClass (#7578)
This one was really interesting to type as it's doing a lot of unusual JavaScript. Fortunately flow is now pretty kick ass and I've been able to mostly type it. The only missing piece is that it won't check the constructor arguments.

If you are a fb employee, you can follow the discussion here: https://www.facebook.com/groups/flowtype/permalink/1132359430146004/
(cherry picked from commit 19b8eadb24)
2016-10-03 16:27:34 -07:00
Christopher Chedeau fb7b8f201f Remove keyMirror in ReactPropTypeLocations (#7592)
This one involves a bit more work as I added "phantom" flow types to a bunch of places where the type is a ReactPropTypeLocations even though those files are not `@flow` yet.

A good side effect is that `ReactPropTypeLocationNames` keys are now correctly typed, this means that they cannot go out of sync without breaking flow :)
(cherry picked from commit 84084153ed)
2016-10-03 16:27:33 -07:00
Christopher Chedeau 283dbc30ee Type ReactPropTypesSecret (#7501)
(cherry picked from commit 563f3bbab4)
2016-10-03 16:27:32 -07:00
Christopher Chedeau f4374bd168 Type ReactElementSymbol (#7564)
(cherry picked from commit a72a156f58)
2016-10-03 16:27:31 -07:00
Christopher Chedeau 52235eadfd Type canDefineProperty (#7500)
(cherry picked from commit 18003578b1)
2016-10-03 16:27:31 -07:00
Christopher Chedeau cb963b09ab Type ReactPropTypeLocations (#7502)
(cherry picked from commit ad3c65186e)
2016-10-03 16:27:31 -07:00
Christopher Chedeau 1fb75eaa9e Type ReactPropTypeLocationNames (#7503)
(cherry picked from commit 7f64baad78)
2016-10-03 16:27:31 -07:00
Sebastian Markbåge cc2e5cc3d7 Require the isomorphic React instead of internals from renderers (#7473)
This is needed for flat builds. It also lets us get rid of a bunch
of special cases in the build scripts.

It also allow us to just copy the source files into React Native
instead of having to build first to resolve the special cases.
(cherry picked from commit 1c5a639c37)
2016-10-03 16:23:16 -07:00
Nathan Hunzaker 8e79c9fd30 Add some semicolons for linting. (#7390)
(cherry picked from commit 8aed0cd67e)
2016-08-15 15:19:58 -07:00
Dan Abramov 382f1519b2 Prevent performance regression in DEV due to warning arguments (#7461)
* Prevent internal performance regression

This only affects Facebook website, not open source version of React.

On the Facebook website, we don't have a transform for warnings and invariants.
Therefore, expensive arguments will be calculated even if the warning doesn't fire.
This fixes a few cases where that calculation might be more expensive than usually.

In my testing, this brings down average row click time in Power Editor from ~300ms to ~220ms in __DEV__ (vs ~40ms in prod).

* Put warning() that shows up in profile behind condition

(cherry picked from commit 178cb7d339)
2016-08-12 16:02:29 -07:00
Keyan Zhang 992e11b852 Merge pull request #7381 from keyanzhang/rename-hooks
Rename Devtool to Hook
(cherry picked from commit 328fc75bc9)
2016-08-12 16:00:09 -07:00
Keyan Zhang 3c7f275f4f Merge pull request #7321 from keyanzhang/codemod-es6-component
Codemod tests from createClass to ES2015 classes
(cherry picked from commit 484f96bb61)
2016-08-12 16:00:08 -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
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
Dan Abramov 7547d0d8e5 Inline dev-only requires (#7188)
* Inline dev-only requires

This reduces the production bundled build size.

* Use new references after resetting module registry in tests

This fixes the tests which were broken due to inlining some requires.

(cherry picked from commit 8fe6b5fb46)
2016-07-08 10:48:57 -07:00
Christopher Chedeau d7a6c95464 [flow] fix flattenChildren type (#7110)
Summary:
Make the debug attribute optional

Test Plan:
npm run flow

Reviewers: @keyanzhang @chicoxyzzy
(cherry picked from commit 07cfba17a9)
2016-07-08 10:48:57 -07:00
Sebastian Markbåge c625bc88aa Unshare not actually shared files (#7167)
This moves some files out of shared that are not actually shared
with isomorphic. They're specific to the renderers.
(cherry picked from commit 4bc1048e0d)
2016-07-08 10:48:56 -07:00
Esteban 32cadeacdb Remove comment about PooledClass destructors being optional (#6560)
They are no longer optional since #4720
(cherry picked from commit 752e1595fc)
2016-07-08 10:48:56 -07:00
Sergey Rubanov a3c0d68af9 [flow] add some typings to utils (#7104)
* add some typings to utils

* add typing of flattenChildren

* more accurate typings for flattenChildren

(cherry picked from commit 3b5c756c7a)
2016-07-08 10:48:56 -07:00
Christopher Chedeau 24cf5c7a5e [flow] type deprecated (#7076)
Summary:

Test Plan:
npm run flow

Reviewers: @zpao @spicyj @gabelevi
(cherry picked from commit 9342c2f02f)
2016-07-08 10:48:56 -07:00
Christopher Chedeau eb9f4efde7 [flow] type adler32 (#7080)
This one is trivial

Test Plan:
npm run flow

Reviewers: @zpao @spicyj
(cherry picked from commit 489caeb2d7)
2016-07-08 10:48:55 -07:00
Christopher Chedeau 8ee93720ce [flow] type KeyEscapeUtils (#7079)
Summary:

The only call site ensures that the value is not null: https://github.com/facebook/react/blob/dc6fc8cc0726458a14f0544a30514af208d0098b/src/shared/utils/traverseAllChildren.js#L44

key is stringified inside of createElement, so we are guaranteed to receive a string right now: https://github.com/facebook/react/blob/dc6fc8cc0726458a14f0544a30514af208d0098b/src/isomorphic/classic/element/ReactElement.js#L142

Test Plan:
npm run flow

Reviewers: @zpao @spicyj
(cherry picked from commit 12a6ad1ef5)
2016-07-08 10:48:55 -07:00
Christopher Chedeau cea00b4b21 Merge pull request #7053 from vjeux/flow_accumulate
[flow] annotate accumulate, accumulateInto and forEachAccumulated
(cherry picked from commit 5b4dad31f8)
2016-07-08 10:48:55 -07:00
Keyan Zhang e974383cba Add reactProdInvariant and corresponding babel rewrite pass (#6948)
(cherry picked from commit 1abce1630c)
2016-06-14 15:50:38 -07:00
Dan Abramov c8b2a3dc13 Merge pull request #6872 from gaearon/jest-cli@12
Update to Jest 12.1.1 and Jasmine 2
(cherry picked from commit c0ecde687a)
2016-06-14 15:49:43 -07:00
Keyan Zhang 23d3e70b4e Add component stack info to key validation warnings (#6799)
* Add component stack info to key validation warnings

* Add `ReactComponentTreeDevtool.getStackAddendumByID`
(cherry picked from commit 47e49ae8b7)
2016-06-14 15:34:27 -07:00
Ben Alpert 5d3920f5ab Rename host-y things to be "host" not "native" (#6754)
For clarity.

I left "native event" as-is because there's a lot of it, it's not particularly ambiguous, and SimulateNative/nativeTouchData are public API in ReactTestUtils.
(cherry picked from commit ba9b985406)
2016-06-14 15:34:19 -07:00
Ben Alpert e15a7d1f7e Revert "Don't wrap drag events in IE/Edge in dev builds" (#6741)
(cherry picked from commit 98cb2f8507)
2016-05-12 11:38:07 -07:00
Christoph Pojer 09c6d53e64 Merge pull request #6620 from cpojer/master
Update to Jest 12. Codemod to new Jest APIs.
(cherry picked from commit d07b554291)
2016-05-09 22:05:09 -07:00
Jim 1f1dba92a8 Merge pull request #6364 from p-jackson/issue-5700
Don't wrap drag events in IE/Edge in dev builds
(cherry picked from commit 2e8f28c29f)
2016-05-09 21:54:17 -07:00
hkal da6e4853be Helper for escaping and unescpaing component keys (#6500)
- Abstract escaping
- Provide human readible same key warnings
(cherry picked from commit dc6fc8cc07)
2016-04-27 23:12:19 -07:00
Dan Abramov 9d73b2339a Merge pull request #6388 from gaearon/bye-bye-deprecated-utils
Remove OrderedMap and ReactPropTransferer
(cherry picked from commit b8f8360b5c)
2016-04-27 23:05:48 -07:00
Paul O’Shannessy 1573baaee8 Use Object.assign directly and inject object-assign at compile 2016-04-04 09:53:25 -07:00
Michael McDermott 18af9bc91e Fixed some linting warnings and some mis-spacing in SyntheticEvent warnings. 2016-03-02 18:40:23 -05:00
Rick Beerendonk bef45b0b1a Year-agnostic copyright message, like React Native uses, to prevent the need for yearly changes. 2015-12-29 20:20:32 +01:00
Jim 3afced6a75 Error boundaries. 2015-12-16 12:15:26 -08:00
Ben Alpert 46f5251c66 Remove @typechecks
These don't really do anything.

```
codemod.py -d src --extensions js -m '\s* \* @typechecks.*?\n' '\n'
```

with "yes to all".
2015-12-10 11:26:45 -08:00
Ben Alpert 6b3ee0e74d Merge pull request #5576 from spicyj/log-top-level
Log top-level renders with console.time
2015-12-01 11:34:40 -08:00
Ben Alpert a0f88d29df Log top-level renders with console.time
Behind a flag.
2015-12-01 11:29:13 -08:00
Paul O’Shannessy f44a0778e3 Don't use key when defined on String, Number prototypes 2015-11-23 15:33:34 -08:00
Ben Alpert ea31f924b8 Merge pull request #5368 from spicyj/adler32
adler32: Properly break loop into 4096-char blocks
2015-11-11 22:21:22 -08:00
Ben Alpert b80f676d27 Add hooks back for devtools 2015-11-04 11:39:44 -08:00
Ben Alpert 35543c6312 Remove unused modules
- Remove last references to ReactInstanceHandles (still used in responder unit test)
- Remove ClientReactRootIndex/ServerReactRootIndex
2015-11-04 11:39:44 -08:00
Ben Alpert ff6714064f adler32: Properly break loop into 4096-char blocks
I believe this was lost in translation in #4400. Can't say I fully understand why this is significant at all though...
2015-11-02 11:29:48 -08:00
Christoph Pojer 1384d43f53 Merge pull request #5321 from cpojer/update-tests
Update tests
2015-10-29 18:42:12 -07:00
Paul O’Shannessy 12c214a992 Merge pull request #5328 from zpao/non-native-event-name-dispatch
Use a custom event type for our event dispatching in ReactErrorUtils
2015-10-29 17:54:18 -07:00
Paul O’Shannessy 29523d0113 Use a custom event type for our event dispatching in ReactErrorUtils
It turns out that IE doesn't like when native events types are used. There may
have been more involved at play but this fixes the issue.
2015-10-29 15:39:14 -07:00