Commit Graph

8162 Commits

Author SHA1 Message Date
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
Brian Vaughn df13eb354e Fixed lint warning in master (#8960) 2017-02-09 16:02:47 +00:00
Sebastian Markbåge 741d9b2db9 Move React Native Environment Mocks to root (#8963)
These mocks are things we expect to be available in the React Native
environment. I'd like to move them out of the renderer folder so that we
can sync that folder to React Native as is without overriding its mocks.

I motivate by the fact that they're not really part of the renderer code
itself. I leave the ReactNative mock since that is in fact part of the
renderer.
2017-02-09 16:02:09 +00:00
Sebastian Markbåge 13e05b4237 Use separate feature flag for ReactTestRenderer (#8965)
The ReactDOMFeatureFlags is not reachable from the npm package since it is
in a separate build so we need a separate one.
2017-02-09 16:00:59 +00:00
Brian Vaughn ab757e905c Fixed ReactNativeFiber event handling regression (#8959)
* Fixed ReactNativeFiber event system regression introduced in b354db2
Also added test coverage to ReactNativeEvents-test for Fiber

* ReactNative tests now run against fiber renderer when env flag set
Updated the test-framework-setup file so that record-tests runs native tests against ReactNativeFiber. ReactComponentTreeHook native tests all now fail but that's expected.

* Avoid calling setChildren() if no children
2017-02-08 21:28:56 -10:00
Sebastian Markbåge 81bd138144 findNodeHandle -> ReactNative.findNodeHandle (#8962)
Submitted this internally already.

Needed because people import this file directly and they might not have the renderer inject the findNodeHandle handler yet.
2017-02-08 17:13:33 -08:00
Andrew Clark 9b7dc4036c Merge pull request #8948 from acdlite/fiberdonttesthostcleanup
[Fiber] Don't test input value clean-up in Fiber
2017-02-08 15:33:20 -08:00
Andrew Clark f4cabafc8d Don't test input value clean-up in Fiber
Fiber doesn't clean up host components; relies on GC.
2017-02-08 10:26:47 -08:00
Sebastian Markbåge b187142103 Move DOM dependent tests out of the shared folder (#8954)
We have a bunch of tests that are meant to test generic React behavior.
However, we've written the tests against the DOM renderer. This moves
tests that depend on ReactDOM or ReactTestUtils out of the shared repo.

This will let us sync the shared repo directly to environments that don't
support running these tests. Such as React Native.
2017-02-08 10:20:02 -08:00
Dan Abramov 1d90894f93 Re-add the warning if PropType function is called manually (#8903)
* Revert "Revert "Warn if PropType function is called manually (#7132)""

This reverts commit be71f76ed8.

In other words, now we again have the warning if you attempt to call PropTypes manually.
It was removed in #8066 but we shouldn't have done this since we still want to avoid people accidentally calling them in production (and even more so since now it would throw).

Fixes #8080.

* Pass secret in ReactControlledValuePropTypes

* Record tests
2017-02-08 16:29:19 +00:00
Dhyey Thakore 994a0c8b0c update react perf docs (#8060) and (#6174) (#8236)
* update react perf docs issue 8060 and 6174

* Grammar

Small stuff
2017-02-07 14:00:08 -08:00
Dan Abramov e280f5a1a7 Fix lint (#8945) 2017-02-07 14:42:09 +00:00
Andrew Clark 5cfff8706e Merge pull request #8919 from acdlite/fibermounttests
[Fiber] Mount/unmount warnings and invariants
2017-02-06 18:00:50 -08:00
Andrew Clark 0564b08cf2 Split into multiple invariants
That way the messages are extracted by the error code transform.
2017-02-06 17:59:53 -08:00
Andrew Clark 23f9e7b8ad Merge pull request #8937 from acdlite/inlineinternalerrormessage
Inline internal error message
2017-02-06 17:44:26 -08:00
Andrew Clark 2c7c783498 Merge pull request #8936 from acdlite/removemapsaschildren
Remove experimental support for maps as children
2017-02-06 17:14:30 -08:00
Andrew Clark 14962f8b40 Continue warning if a Map is rendered as a child
The entries of a map are a two-element array of [key, value], which
React will treat as fragments with children. This is unlikely to ever
be the intended behavior, so we warn.
2017-02-06 17:07:19 -08:00
Andrew Clark 94e843955d Remove experimental support for maps as children 2017-02-06 15:51:19 -08:00
Andrew Clark 2e1b3aab91 Inline internal error message
So that it is stripped out by the error code transform
2017-02-06 15:43:47 -08:00
Andrew Clark a2c49f48bf Merge pull request #8926 from acdlite/fiberuseinvariant
[Fiber] Replace `throw new Error` with invariant module
2017-02-06 14:49:14 -08:00
Andrew Clark 915a3e88a2 Add additional message to internal invariants
The message tells users that the error is likely due to a bug in React,
and that they should file an issue.
2017-02-06 14:43:57 -08:00
Andrew Clark b338c75c28 Get rid of DEV only invariant 2017-02-06 14:43:22 -08:00
Andrew Clark a1ef4c4391 Replace throw new Error with invariant module 2017-02-06 14:43:14 -08:00
Andrew Clark 9fcf761e90 Run test script 2017-02-06 14:22:27 -08:00
Andrew Clark 255e5aeb3e Rendering into an empty React-rendered element should not warn
Only warn if the container has a React-rendered child.
2017-02-06 14:22:16 -08:00
Sebastian Markbåge e05f0a3a13 Only expose FiberRoot at the top level instead of a Fiber (#8934)
It is strange to get a handle on the Fiber since it is one of possibly two
root Fibers. The correct way to get the current Fiber is through the
root.current.

I exposed the Fiber originally because I thought we might use it for
Portals but we went with a different approach. So we don't need this.
2017-02-06 13:19:33 -08:00
Andrew Clark b49611e643 Merge pull request #8927 from mitenka/patch-5
Update higher-order-components.md
2017-02-06 11:42:31 -08:00
Jon Bretman afdf47f425 Bump fbjs to 0.8.9 (#8910) 2017-02-06 19:02:17 +00:00
Dan Abramov fb1444c463 Inject DevTools integration for RN Fiber (#8930) 2017-02-06 17:36:59 +00:00
KB d42c285aa2 [docs] Add note about refs on stateless components (#8916)
* Add note about refs on stateless components

* Move info about refs in the stateless components to the main section

* Simplification of the part about refs and functional components

* Tweaks

* Move sections around

* Oops

* Rearrange more sections
2017-02-06 16:49:36 +00:00
António Nuno Monteiro 4313059702 Change the order between function declaration and object assignment (#8895)
This fixes #8894
2017-02-06 16:02:13 +00:00
Dmitry Zhuravlev-Nevsky 1b69a79136 Update higher-order-components.md 2017-02-04 03:35:06 +03:00
Ben Alpert fa1087b42c Ensure first error is thrown if HostRoot catches two errors in commit phase (#8923)
Previously, we were overwriting capturedErrors with the second error and throwing that one.
2017-02-03 11:12:28 -08:00
Diego Muracciole ad133f5b3d Add onToggle event to details tag (#8831)
* Add onToggle event to details tag

Fixes #8761

* Map onToggle event on ReactDOMFiberComponent

* Tweak doc

* Trap events on setInitialProperties for details tag
2017-02-03 10:25:09 +00:00
Andrew Clark 269555e35c Merge pull request #8921 from facebook/revert-8907-fiberproderrorcode
Revert "Loosen assertion so it matches any production error"
2017-02-02 15:24:04 -08:00
Andrew Clark bd3070f774 Revert change to test
See: https://github.com/facebook/react/pull/8907#issuecomment-277111278
2017-02-02 15:22:28 -08:00
Andrew Clark 57d2d6d77d Merge pull request #8907 from acdlite/fiberproderrorcode
Loosen assertion so it matches any production error
2017-02-02 14:42:23 -08:00
Andrew Clark 87bc7cef2c Warn if unmounting a tree that was rendered by a different copy of React 2017-02-02 14:30:12 -08:00