Commit Graph

14 Commits

Author SHA1 Message Date
Ben Alpert 3cc733add4 Fix severe perf problems in component tree devtool (#6770)
One of the ReactMultiChildText tests renders 2145 roots (and even more components) and unmounts none of them. Now we don't loop through them all a bunch of times so the test takes 20 seconds instead of 60.

We should clean up instantiateReactComponent somehow so that the onSetDisplayName call isn't produced for the TopLevelWrapper, which should allow us to just store an array of unmountedIDs instead of a hash map so we at least don't have double maps. This change mirrors the old logic though.

Reviewers: @gaearon, @sebmarkbage
2016-05-14 12:13:48 -07:00
Ben Alpert 03f4ba260b Track source more generically in ReactComponentTreeDevtool (#6765)
Being able to get the source for your parent components seems useful, and ReactComponentTreeDevtool is best poised to be able to do that.

I'm also not sure it makes sense to have separate DOM-specific `onMountDOMComponent` and `onUpdateDOMComponent` events, so I removed them for now. Even if we want them, their timing seemed sort of arbitrary.

I also made it so DOM devtools can listen to non-DOM events too. Willing to change that if people think it's ugly though.
2016-05-14 12:12:12 -07:00
Dan Abramov 3779a5d18c Fix a memory leak in ReactComponentTreeDevtool
`ReactDebugTool` used to only call `purgeUnmountedComponents()` while profiling, so information about unmounted instances kept accumulating when not profiling.

Additionally, unmounting in React Native and rendering to string did not correctly clean up the devtool.

Finally, the tests tested the wrong behavior and relied on explicit `purgeUnmountedComponent()` calls.

To fix this, we:

* Test specifically that unmounting is enough to clean up the tree devtool.
* Add missing `onBeginFlush` and `onEndFlush` calls to server and native rendering so `ReactDebugTool` knows when to copy the tree.

Fixes #6750
2016-05-12 03:19:55 +01:00
Dan Abramov bc241bfcfe Add getUpdateCount() to ReactComponentTreeDevtool
It is necessary to exclude just mounted components from wasted calculation.
2016-05-03 14:21:30 +01:00
Dan Abramov a9e0896af8 Mute devtool events for TopLevelWrapper and empty components 2016-04-26 01:02:45 +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
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 b5997c8e7b Extract ReactComponentTreeDevtool 2016-04-21 17:31:04 +01:00