Commit Graph
170 Commits
Author SHA1 Message Date
Desmond BrandandJim db175052c0 Add links to docs for addons and top level API (#6555)
This makes it easier to figure out where the docs live.

Googling for e.g. `react-addons-update` also works, but this should
make things easier for people that hyperclick directly to the source.
2016-05-02 06:14:28 -07:00
Dan Abramov b7f6a642f6 Make ReactComponentTreeDevtool work with React Native 2016-04-29 16:13:21 +01:00
Dan Abramov 67b1dbf75f Add new ReactPerf 2016-04-28 20:45:57 +01:00
cpojer 8e34514096 Update to Jest 12. Codemod to new Jest APIs. 2016-04-28 14:54:57 +09:00
Dan Abramov b8f8360b5c Merge pull request #6388 from gaearon/bye-bye-deprecated-utils
Remove OrderedMap and ReactPropTransferer
2016-04-27 20:36:39 +01:00
Dan Abramov 2723323006 Remove OrderedMap and ReactPropTransferer
These are not exposed publicly and have been deprecated.
2016-04-27 17:44:02 +01:00
Dan Abramov aaadb31827 Add ReactNativeOperationHistoryDevtool to track native operations 2016-04-26 23:50:58 +01:00
Dan Abramov 76a4c46dba Merge pull request #6549 from gaearon/instrumentation-new
Provide info about component tree to devtools
2016-04-26 01:12:23 +01:00
Dan Abramov a9e0896af8 Mute devtool events for TopLevelWrapper and empty components 2016-04-26 01:02:45 +01:00
Dan Abramov 7dbc95f379 Merge pull request #6605 from gaearon/fix-warning-condition
Fix the warning condition in ReactDebugTool and ReactDOMDebugTool
2016-04-25 20:16:52 +01:00
Dan Abramov 1f97103d7b Flip the warning condition in ReactDebugTool and ReactDOMDebugTool
The current warning condition caused the first error to be swallowed, and all the next errors to be logged. I believe the intention was the opposite: to log the first error, and to ignore any next errors for the same method.
2016-04-25 00:41:53 +01:00
Dan Abramov f89f94d145 Add tests for ReactDebugTool and ReactDOMDebugTool 2016-04-25 00:41:32 +01:00
Dan Abramov acd67c368d Remove isComposite and hide TopLevelWrapper 2016-04-25 00:05:04 +01:00
Dan Abramov 9f16003e69 Assert that unmounted instances are in the tree until purged 2016-04-24 01:53:53 +01:00
Dan Abramov 829558b8b0 Refactor how native container ID is stored 2016-04-23 22:27:40 +01:00
Dan Abramov 900a588f63 Add safeguards to ReactComponentTreeDevtool 2016-04-23 02:23:16 +01:00
Dan Abramov df3c85886e Stop exposing ReactComponentTreeDevtool internal tree directly 2016-04-22 15:45:35 +01:00
Dan Abramov 1ebffa59fe ReactComponentTreeDevtool should ignore TopLevelWrapper 2016-04-22 02:42:29 +01:00
EstebanandJim 416f315c96 Fix return type in onlyChild's JSDoc (#6573)
The return type is a 'ReactElement' instead of a 'ReactComponent'.
2016-04-21 16:02:20 -07:00
EstebanandJim 9462d0d040 Fix mapFunction parameters in mapChildren's JSDoc (#6569)
Remove 'key' parameter from 'mapFunction(child, key, index)'. It is no longer called with 'key'.
2016-04-21 14:28:08 -07:00
Dan Abramov e20d366ea8 Fix expect() slipping into the non-test code 2016-04-21 22:23:35 +01:00
Dan Abramov ab0ef89ec7 Track parentID for ReactPerf 2016-04-21 17:59:31 +01:00
Dan Abramov f530b977ec Test ReactComponentTreeDevtool specifically 2016-04-21 17:32:56 +01:00
Dan Abramov b5997c8e7b Extract ReactComponentTreeDevtool 2016-04-21 17:31:04 +01:00
Dan Abramov 835ca9bca3 Clean up the devtool tree on server rendering 2016-04-21 02:37:58 +01:00
Dan Abramov af3603ea2f Devtools should be able to clean up the tree on client rendering 2016-04-20 19:11:38 +01:00
Dan Abramov 367594a213 Enforce that info about children is available by the time onSetChildren() fires 2016-04-20 18:20:14 +01:00
Dan Abramov 1587abf6f0 Don't report children for empty and text nodes 2016-04-20 18:12:40 +01:00
Dan Abramov 804c680f06 Report dangerouslySetInnerHTML as no children 2016-04-20 18:01:52 +01:00
Dan Abramov 7884606fdb Handle updates to natives and composites 2016-04-20 17:39:33 +01:00
Dan Abramov e9f8d57c70 Add an initial implementation of ReactDebugTool events 2016-04-20 16:59:13 +01:00
Dan Abramov b692893640 Revert "Add ReactDebugInstanceMap"
This reverts commit 575fb79162.
2016-04-20 16:59:13 +01:00
Paul O’Shannessy fc1cfb6225 Make React.__spread warn 2016-04-07 17:30:23 -07:00
Paul O’Shannessy f02d87bdb5 Revert "Merge pull request #6431 from sebmarkbage/killspread"
This reverts commit a37e4e94fc, reversing
changes made to 411951d5b8.
2016-04-07 16:16:37 -07:00
Jim 7b47e3e537 Merge pull request #6134 from richardscarrott/master
Warn if props obj passed into createElement / cloneElement inherits from anything other than Object
2016-04-07 14:09:18 -07:00
Sebastian Markbage a142fd2578 Kill React.__spread
This was only for a JSTransform related experiment that is now
dead along with JSTransform.
2016-04-06 17:08:50 -07:00
Paul O’Shannessy 1573baaee8 Use Object.assign directly and inject object-assign at compile 2016-04-04 09:53:25 -07:00
Dan Abramov 575fb79162 Add ReactDebugInstanceMap
This PR is the first in a series of pull requests split from the new `ReactPerf` implementation in #6046.

Here, we introduce a new module called `ReactDebugInstanceMap`. It will be used in `__DEV__` and, when the `__PROFILE__` gate is added, in the `__PROFILE__` builds. It will *not* be used in the production builds.

This module acts as a mapping between “debug IDs” (a new concept) and the internal instances. Not to be confused with the existing `ReactInstanceMap` that maps internal instances to public instances.

What are the “debug IDs” and why do we need them? Both the new `ReactPerf` and other consumers of the devtool API, such as React DevTools, need access to some data from the internal instances, such as the instance type display name, current props and children, and so on. Right now we let such tools access internal instances directly but this hurts our ability to refactor their implementations and burdens React DevTools with undesired implementation details such as having to support React ART in a special way.[1]

The purpose of adding `ReactDebugInstanceMap` is to only expose “debug IDs” instead of the internal instances to any devtools. In a future RP, whenever there is an event such as mounting, updating, or unmounting a component, we will emit an event in `ReactDebugTool` with the debug ID of the instance. We will also add an introspection API that lets the consumer pass an ID and get the information about the current children, props, state, display name, and so on, without exposing the internal instances.

`ReactDebugInstanceMap` has a concept of “registering” an instance. We plan to add the hooks that register an instance as soon as it is created, and unregister it during unmounting. It will only be possible to read information about the instance while it is still registered. If we add support for reparenting, we should be able to move the (un)registration code to different places in the component lifecycle without changing this code. The currently registered instances are held in the `registeredInstancesByIDs` dictionary.

There is also a reverse lookup dictionary called `allInstancesToIDs` which maps instances back to their IDs. It is implemented as a `WeakMap` so the keys are stable and we’re not holding onto the unregistered instances. If we’re not happy with `WeakMap`, one possible alternative would be to add a new field called `_debugID` to all the internal instances, but we don’t want to do this in production. Using `WeakMap` seems like a simpler solution here (and stable IDs are a nice bonus). This, however, means that the `__DEV__` (and the future `__PROFILE__`) builds will only work in browsers that support our usage of `WeakMap`.

[1]: https://github.com/facebook/react-devtools/blob/577ec9b8d994fd26d76feb20a1993a96558b7745/backend/getData.js
2016-03-31 17:58:55 +01:00
Dan Abramov b6bc4bd996 Spy at warnings consistently inside test cases
We move any spies on `console.error()` from `beforeEach()` to the individual `it()` tests. This means that if a new test is introduced in these suites, it does not ignore warnings by default, but fails on any unexpected warning, which is Jest's default behavior.

We also change a few old instances of direct `console.error = jest.genMockFn()` assignment to use `spyOn()` for consistency with the rest of the tests.
2016-03-30 22:01:20 +01:00
Richard 17683e0410 Warn if props obj passed into createElement / cloneElement inherits from anything other than Object 2016-03-29 20:21:39 +01:00
Paul O’Shannessy d17091ddeb Make Browserify-specific modules to remove DOM dependencies from npm package 2016-03-24 15:28:52 -07:00
Dan Abramov ebe5128489 Use specific method names in error messages 2016-03-21 21:40:17 +00:00
Leland Richardson f938299765 [fix] key/ref warnings incorrectly throw on DOM Elements 2016-03-08 18:51:06 -08:00
rainer oviir 9c1916dedb Fix #6114 - Calling setState inside getChildContext should warn 2016-03-04 23:20:29 -08:00
Max 32b0c62214 Copy and paste no-jsx note from top of file to places where it's used
Closes #6157
2016-03-01 20:06:20 +01:00
chico 03925f4f06 Using Object.is implementation when compare values inside React.PropTypes.oneOf 2016-02-29 18:46:19 +03:00
Dan Abramov 92530b4ddc Merge pull request #6068 from gaearon/react-instrumentation
Add ReactInstrumentation
2016-02-26 17:18:19 +00:00
Ben Alpert 74070e5838 Merge pull request #6082 from spicyj/nq-set-props
Remove unused enqueueSetProps methods
2016-02-26 00:39:48 -08:00
Ben Alpert cf4255445e Remove unused enqueueSetProps methods 2016-02-21 14:30:23 -08:00
Jim 70b5eda83e Merge pull request #5997 from truongduy134/clone-element
Fix #5929. Resolve to default props when config key is set to undefined in cloneElement
2016-02-19 14:53:38 -08:00