Commit Graph

8304 Commits

Author SHA1 Message Date
Andrew Clark 2081a0053a Merge pull request #8949 from acdlite/fibercomponentlifecycletests
[Fiber] Component lifecycle tests
2017-02-22 12:54:42 -08:00
Brian Vaughn a44a5d68d8 Fix bugs that occur when event responder unmounts during a touch event sequence
> This PR adds a test (initially failing) for this case along with a fix for stack and fiber. The stack fix was copied from a Diff submitted by @sema. The fiber fix just required us to stop leaking properties for unmounted views.
> Longer term we may want to explicitly invoke a release event listener for a responder just before unmounting it. This PR does not do that.
2017-02-22 12:47:34 -08:00
Andrew Clark 42c375b136 Merge pull request #9040 from acdlite/assignstateincwrp
Support for assigning to this.state inside componentWillReceiveProps
2017-02-22 12:45:58 -08:00
Stephie 5cc2a4fe3e Fixed typo: "Calcutor" to "Calculator" (#9047) 2017-02-22 17:37:55 +00:00
Dan Abramov 55f18f20ea Update Fiber debugger deps 2017-02-22 17:20:53 +00:00
Michał Pierzchała 67c1fde70e Upgrade Jest to v19 (#9034) 2017-02-22 16:59:18 +00:00
Dominic Gannaway b8cf75a5b4 updated tests-failing and test-passing 2017-02-22 16:16:21 +00:00
Dominic Gannaway 3a7d6f5384 moved require(emptyObject) to inline calls to get around referential mismatch
Due to how Jest and other mocking libraries work in userland, modules that are required might not be referentially equal at various stages of the application lifecycle. This isnt a perfect fix, but by having the require calls inline, it has a better liklihood of ensuring emptyObject is the same reference
2017-02-22 16:12:51 +00:00
Dominic Gannaway a9325e2ec4 adds childContextTypes warnings for functional components
ReactStatelessComponent-test.js fails due to warnings not showing up when functional components mount or update. This PR ports the existing warnings from stack and re-applies them to fiber functional components and attempts to re-use some logic in ReactFiberContext that currently exists for showing warnings when dealing with class components.
2017-02-22 14:21:10 +00:00
Andrew Clark d649ebc6e1 Test should ensure that update is applied before corresponding render
Tightens up the test a bit to prevent regressions.
2017-02-21 16:47:25 -08:00
Brian Vaughn 3d44a6a486 Improved stack/fiber type-check to avoid false negative match when inst._rootNodeID is 0 2017-02-21 15:14:18 -08:00
Andrew Clark 28dbbe5734 Run test script 2017-02-21 14:43:01 -08:00
Andrew Clark d3cbbe3b36 Add deprecation warning for assigning to this.state inside cWRP
We'll remove support for this in a future release, though we'll likely
still warn.
2017-02-21 14:42:12 -08:00
Andrew Clark adc1641fec Should be able to setState inside cWRP before assigning to this.state
...without dropping the update. This won't work the other way around,
if you assign to this.state before calling setState. we'll add a
deprecation warning so people stop relying on this pattern.
2017-02-21 14:40:56 -08:00
Andrew Clark d98a3d9269 Support assigning directly to this.state inside cWRP
We don't explicitly support this but it happens to work in Stack. We'll
give it the same semantics as replaceState.
2017-02-21 14:29:30 -08:00
Dan Abramov 51733c9a36 Add more details to the doc 2017-02-19 12:07:54 +00:00
Dan Abramov 6d6211f526 Doc consistency tweaks 2017-02-19 11:58:42 +00:00
Roman Matusevich d28264e689 Remove extra article from documentation (#9028) 2017-02-19 11:10:50 +00:00
DanZeuss fc362bf095 Improved for a better understanding (#8970)
* Improved for a better understanding

that code shouldn't name this parameter onchange. It is so confusing for a starter of ReactJs like me. It looks like that the onChange is an common event from props.

* Update the lifting state up paragraph

I tried to write something to explain to starter programmers in react, how we lift the state up calling a method defined by the ancestor and called by the children that will affect the children element.

* Rewrite Lifting State Up
2017-02-19 02:21:05 +00:00
Ben Alpert bc2702f8bd Fix Fiber devtools prod (#9019) 2017-02-16 18:00:49 -08:00
Dimzel Sobolev 764531d53a Switch to shipping Fiber in npm packages (#9015) 2017-02-16 15:42:04 +00:00
Ben Alpert d20dea1de2 Update to babel-plugin-transform-es2015-block-scoping 6.23 (#9002)
Now we won't add closures unnecessarily. I verified that we have no code that throws -- adding some then running `grunt build:modules` correctly throws.
2017-02-14 11:24:01 -08:00
Sebastian Markbåge 66bae80b08 Move validation calls behind DEV blocks (#8999)
This was done for Fiber but not Stack, causing these to throw in prod.
2017-02-14 11:10:59 -08:00
Sebastian Markbåge 5a1e30a868 Ignore events on text nodes (#9000)
In React Native events can fire on text nodes (on Android at least).

In that case, the current element will be a string and not props. These
can not have event handlers on them so we need to bail out so that
we don't throw later on.
2017-02-14 11:08:29 -08:00
Dan Abramov 7bdc189147 Revert "update react perf docs (#8060) and (#6174)" (#8997) 2017-02-13 23:43:08 +00:00
Toru Kobayashi 080f21e64f Remove an unnecessary condition 2017-02-13 15:36:13 -08:00
Dan Abramov 2464cd2d53 Update Thinking in React embed to match the link (#8996) 2017-02-13 23:25:47 +00:00
Brandon Dail 1ccb9361fe Revert "Revert "Missing a space for error 125"" (#8995) 2017-02-13 23:15:08 +00:00
Dan Abramov c906fecd26 Revert "Missing a space for error 125" (#8994) 2017-02-13 23:11:05 +00:00
Ben Alpert 1e722e4a97 Check alternate in ReactTreeTraversal (#8992)
Test Plan: Couldn't figure out how to write a unit test. :\ Verified that enter/leave bubbling now works correctly in one FB interface that was broken though.
2017-02-13 14:24:44 -08:00
Phil Rajchgot 6367f9fbf3 Missing a space for error 125 (#8981) 2017-02-13 16:21:15 -06:00
Sean Gransee c16ec5df13 fix misspellings in comments and tests (#8946)
* fix misspellings in comments and tests

* revert change in docs/js/react-dom.js
2017-02-13 16:01:54 -06:00
Sebastian Markbåge 890d52bafc Move ReactElementType to shared (#8991)
This is currently used by both isomorphic and the renderer. I think that
we can probably split these up. The isomorphic type should actually be
different. It has to do with that the caller needs to know exactly which
type of element it is but this is never needed in the renderer which only
needs to know that the type is internally consistent.

The owner type is renderer dependent so it can literally be anything.
2017-02-13 13:54:40 -08:00
Dan Abramov 4a05f268c8 Revert "Fix createNodeMock doc to avoid Invariant Violation" (#8990) 2017-02-13 20:15:49 +00:00
Andrew Clark 5ee033e40b Merge pull request #8974 from acdlite/fibercallbackvalidation
[Fiber] Move callback validation to top level
2017-02-13 12:15:42 -08:00
Andrew Clark ea2ade251f Don't pass method names in production
Requires us to make the error message a bit more generic.
2017-02-13 12:13:50 -08:00
BDav24 00092957b6 Fix createNodeMock doc to avoid Invariant Violation (#8989) 2017-02-13 20:13:31 +00:00
Andrew Clark d3aeca1ff8 Validate callbacks just before they are invoked
This delays the type check until the point when the engine will have to
perform a type check regardless.

Because the error is now thrown during the commit phase rather than
when the callback is originally scheduled, we warn in DEV when
scheduling so it's easier to track down.
2017-02-13 12:12:44 -08:00
Andrew Clark 662170673f Merge pull request #8978 from acdlite/nooptionaltypes
[Fiber] Use `T | null` instead of `?T` types
2017-02-13 11:20:58 -08:00
Jiminikiz 7958c1d77d Fixing grammatical error ... (#8987)
... in the Create React App section.
2017-02-13 10:04:09 -08:00
Prayag Verma c60f852cdb Fix a typo in design principles doc (#8985)
unambigious → unambiguous
2017-02-13 15:09:00 +00:00
Andrew Clark 350d736361 Use `T | null` instead of `?T` types
Flow maybe types accept both null and undefined. When the final
parameter of a function accepts a maybe type, passing nothing
(undefined) successfully typechecks, which can lead to bugs if the
omission is accidental. Being forced to pass null is harder to screw up.

Explicit null checks are also faster.
2017-02-10 17:30:09 -08:00
Toru Kobayashi 77c7792556 Remove React.__spread 2017-02-10 12:27:02 -08:00
Moacir Rosa de673bca8d Only fix a small wrong key in example (#8976)
Only fix a small wrong key in example
2017-02-10 15:40:24 +00:00
Brian Vaughn 2e095b4140 Hardened validateCallback to better handle null values (#8973)
Previously, calls to validateCallback() with a null callback value resulted in runtime errors if a certain transform was not applied prior to running. This commit wraps the invariant() with the condition check so as to avoid calling formatUnexpectedArgument() unless necessary. It also replaces the truthy/falsy callback check with an explicit check for improved performance.
2017-02-09 14:10:45 -10:00
Leland Richardson 869c779861 Add toTree() method to stack and fiber TestRenderer (#8931)
* Add toTree() method to stack and fiber TestRenderer

* Address PR feedback

* Refactor TestRenderer to use correct root

* Rebase off master and fix root node references

* Add flow types

* Add test for null rendering components

* Remove last remaining lint error

* Add missing test
2017-02-09 20:55:00 +00:00
Dan Abramov 3f48caab40 Fix release guide again 2017-02-09 16:15:04 +00:00
Dan Abramov 6cfc0ecd72 Fix release guide 2017-02-09 16:14:27 +00:00
Dan Abramov c11733dfb7 Update Yarn lockfile with fresh deps 2017-02-09 16:10:35 +00:00
Dan Abramov c7ebe88c2a 16.0.0-alpha.2 2017-02-09 16:07:56 +00:00