, node);
var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
- ReactNativeOperationHistoryDevtool.clearHistory();
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
{
describe('simple attribute', () => {
it('gets recorded during mount', () => {
var node = document.createElement('div');
+
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
, node);
- var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
+ var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
if (ReactDOMFeatureFlags.useCreateElement) {
assertHistoryMatches([{
instanceID: inst._debugID,
@@ -228,10 +239,11 @@ describe('ReactNativeOperationHistoryDevtool', () => {
ReactDOM.render(
, node);
var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
- ReactNativeOperationHistoryDevtool.clearHistory();
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
, node);
ReactDOM.render(
, node);
ReactDOM.render(
, node);
+
assertHistoryMatches([{
instanceID: inst._debugID,
type: 'update attribute',
@@ -262,9 +274,10 @@ describe('ReactNativeOperationHistoryDevtool', () => {
ReactDOM.render(
, node);
var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
- ReactNativeOperationHistoryDevtool.clearHistory();
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
, node);
ReactDOM.render(
, node);
+
assertHistoryMatches([{
instanceID: inst._debugID,
type: 'update attribute',
@@ -280,9 +293,11 @@ describe('ReactNativeOperationHistoryDevtool', () => {
describe('custom attribute', () => {
it('gets recorded during mount', () => {
var node = document.createElement('div');
+
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
, node);
- var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
+ var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
if (ReactDOMFeatureFlags.useCreateElement) {
assertHistoryMatches([{
instanceID: inst._debugID,
@@ -312,10 +327,11 @@ describe('ReactNativeOperationHistoryDevtool', () => {
ReactDOM.render(
, node);
var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
- ReactNativeOperationHistoryDevtool.clearHistory();
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
, node);
ReactDOM.render(
, node);
ReactDOM.render(
, node);
+
assertHistoryMatches([{
instanceID: inst._debugID,
type: 'update attribute',
@@ -343,9 +359,11 @@ describe('ReactNativeOperationHistoryDevtool', () => {
describe('attribute on a web component', () => {
it('gets recorded during mount', () => {
var node = document.createElement('div');
+
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
, node);
- var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
+ var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
if (ReactDOMFeatureFlags.useCreateElement) {
assertHistoryMatches([{
instanceID: inst._debugID,
@@ -375,10 +393,11 @@ describe('ReactNativeOperationHistoryDevtool', () => {
ReactDOM.render(
, node);
var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
- ReactNativeOperationHistoryDevtool.clearHistory();
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
, node);
ReactDOM.render(
, node);
ReactDOM.render(
, node);
+
assertHistoryMatches([{
instanceID: inst._debugID,
type: 'update attribute',
@@ -411,8 +430,9 @@ describe('ReactNativeOperationHistoryDevtool', () => {
ReactDOM.render(
Hi.
, node);
var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
- ReactNativeOperationHistoryDevtool.clearHistory();
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
Bye.
, node);
+
assertHistoryMatches([{
instanceID: inst._debugID,
type: 'replace text',
@@ -425,8 +445,9 @@ describe('ReactNativeOperationHistoryDevtool', () => {
ReactDOM.render(
, node);
var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
- ReactNativeOperationHistoryDevtool.clearHistory();
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
Bye.
, node);
+
assertHistoryMatches([{
instanceID: inst._debugID,
type: 'replace text',
@@ -439,8 +460,9 @@ describe('ReactNativeOperationHistoryDevtool', () => {
ReactDOM.render(
, node);
var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
- ReactNativeOperationHistoryDevtool.clearHistory();
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
Bye.
, node);
+
assertHistoryMatches([{
instanceID: inst._debugID,
type: 'remove child',
@@ -460,8 +482,9 @@ describe('ReactNativeOperationHistoryDevtool', () => {
var node = document.createElement('div');
ReactDOM.render(
Hi.
, node);
- ReactNativeOperationHistoryDevtool.clearHistory();
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
Hi.
, node);
+
assertHistoryMatches([]);
});
});
@@ -473,8 +496,9 @@ describe('ReactNativeOperationHistoryDevtool', () => {
var inst1 = ReactDOMComponentTree.getInstanceFromNode(node.firstChild.childNodes[0]);
var inst2 = ReactDOMComponentTree.getInstanceFromNode(node.firstChild.childNodes[3]);
- ReactNativeOperationHistoryDevtool.clearHistory();
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
{'Bye.'}{43}
, node);
+
assertHistoryMatches([{
instanceID: inst1._debugID,
type: 'replace text',
@@ -490,8 +514,9 @@ describe('ReactNativeOperationHistoryDevtool', () => {
var node = document.createElement('div');
ReactDOM.render(
{'Hi.'}{42}
, node);
- ReactNativeOperationHistoryDevtool.clearHistory();
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
{'Hi.'}{42}
, node);
+
assertHistoryMatches([]);
});
});
@@ -509,9 +534,11 @@ describe('ReactNativeOperationHistoryDevtool', () => {
ReactDOM.render(
, node);
var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
- ReactNativeOperationHistoryDevtool.clearHistory();
element =
;
+
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
, node);
+
assertHistoryMatches([{
instanceID: inst._debugID,
type: 'replace with',
@@ -528,11 +555,13 @@ describe('ReactNativeOperationHistoryDevtool', () => {
var node = document.createElement('div');
element =
;
ReactDOM.render(
, node);
- var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
- ReactNativeOperationHistoryDevtool.clearHistory();
+ var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
element = null;
+
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
, node);
+
assertHistoryMatches([{
instanceID: inst._debugID,
type: 'replace with',
@@ -550,9 +579,11 @@ describe('ReactNativeOperationHistoryDevtool', () => {
element =
;
ReactDOM.render(
, node);
- ReactNativeOperationHistoryDevtool.clearHistory();
element =
;
+
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
, node);
+
assertHistoryMatches([]);
});
});
@@ -563,11 +594,12 @@ describe('ReactNativeOperationHistoryDevtool', () => {
ReactDOM.render(
Hi.
, node);
var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
- ReactNativeOperationHistoryDevtool.clearHistory();
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
,
node
);
+
assertHistoryMatches([{
instanceID: inst._debugID,
type: 'replace children',
@@ -583,11 +615,12 @@ describe('ReactNativeOperationHistoryDevtool', () => {
);
var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
- ReactNativeOperationHistoryDevtool.clearHistory();
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
,
node
);
+
assertHistoryMatches([{
instanceID: inst._debugID,
type: 'replace children',
@@ -600,11 +633,12 @@ describe('ReactNativeOperationHistoryDevtool', () => {
ReactDOM.render(
, node);
var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
- ReactNativeOperationHistoryDevtool.clearHistory();
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
,
node
);
+
assertHistoryMatches([{
instanceID: inst._debugID,
type: 'remove child',
@@ -627,11 +661,12 @@ describe('ReactNativeOperationHistoryDevtool', () => {
node
);
- ReactNativeOperationHistoryDevtool.clearHistory();
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
,
node
);
+
assertHistoryMatches([]);
});
});
@@ -642,8 +677,9 @@ describe('ReactNativeOperationHistoryDevtool', () => {
ReactDOM.render(
, node);
var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
- ReactNativeOperationHistoryDevtool.clearHistory();
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
, node);
+
assertHistoryMatches([{
instanceID: inst._debugID,
type: 'insert child',
@@ -658,8 +694,9 @@ describe('ReactNativeOperationHistoryDevtool', () => {
ReactDOM.render(
, node);
var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
- ReactNativeOperationHistoryDevtool.clearHistory();
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
, node);
+
assertHistoryMatches([{
instanceID: inst._debugID,
type: 'move child',
@@ -674,8 +711,9 @@ describe('ReactNativeOperationHistoryDevtool', () => {
ReactDOM.render(
, node);
var inst = ReactDOMComponentTree.getInstanceFromNode(node.firstChild);
- ReactNativeOperationHistoryDevtool.clearHistory();
+ ReactNativeOperationHistoryDevtool._preventClearing = true;
ReactDOM.render(
, node);
+
assertHistoryMatches([{
instanceID: inst._debugID,
type: 'remove child',
diff --git a/src/renderers/dom/server/ReactServerRendering.js b/src/renderers/dom/server/ReactServerRendering.js
index 73ce86c46045d..ee57e07438e98 100644
--- a/src/renderers/dom/server/ReactServerRendering.js
+++ b/src/renderers/dom/server/ReactServerRendering.js
@@ -37,6 +37,9 @@ function renderToStringImpl(element, makeStaticMarkup) {
transaction = ReactServerRenderingTransaction.getPooled(makeStaticMarkup);
return transaction.perform(function() {
+ if (__DEV__) {
+ ReactInstrumentation.debugTool.onBeginFlush();
+ }
var componentInstance = instantiateReactComponent(element);
var markup = ReactReconciler.mountComponent(
componentInstance,
@@ -49,6 +52,7 @@ function renderToStringImpl(element, makeStaticMarkup) {
ReactInstrumentation.debugTool.onUnmountComponent(
componentInstance._debugID
);
+ ReactInstrumentation.debugTool.onEndFlush();
}
if (!makeStaticMarkup) {
markup = ReactMarkupChecksum.addChecksumToMarkup(markup);
diff --git a/src/renderers/native/ReactNativeMount.js b/src/renderers/native/ReactNativeMount.js
index 0e5c4838bbdd8..0694ec262c2b5 100644
--- a/src/renderers/native/ReactNativeMount.js
+++ b/src/renderers/native/ReactNativeMount.js
@@ -216,8 +216,14 @@ var ReactNativeMount = {
if (!instance) {
return false;
}
+ if (__DEV__) {
+ ReactInstrumentation.debugTool.onBeginFlush();
+ }
ReactNativeMount.unmountComponentFromNode(instance, containerTag);
delete ReactNativeMount._instancesByContainerID[containerTag];
+ if (__DEV__) {
+ ReactInstrumentation.debugTool.onEndFlush();
+ }
return true;
},