mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Enforce that info about children is available by the time onSetChildren() fires
This commit is contained in:
@@ -57,6 +57,13 @@ describe('ReactDebugTool', () => {
|
||||
updateTree(debugID, item => item.displayName = displayName);
|
||||
},
|
||||
onSetChildren(debugID, childDebugIDs) {
|
||||
childDebugIDs.forEach(childDebugID => {
|
||||
var childItem = tree[childDebugID];
|
||||
expect(childItem).toBeDefined();
|
||||
expect(childItem.isComposite).toBeDefined();
|
||||
expect(childItem.displayName).toBeDefined();
|
||||
expect(childItem.childDebugIDs || childItem.text).toBeDefined();
|
||||
});
|
||||
updateTree(debugID, item => item.childDebugIDs = childDebugIDs);
|
||||
},
|
||||
onSetOwner(debugID, ownerDebugID) {
|
||||
|
||||
@@ -759,10 +759,10 @@ ReactDOMComponent.Mixin = {
|
||||
// TODO: Validate that text is allowed as a child of this node
|
||||
if (__DEV__) {
|
||||
var inlinedTextDebugID = this._debugID + '#text';
|
||||
ReactInstrumentation.debugTool.onSetChildren(this._debugID, [inlinedTextDebugID]);
|
||||
ReactInstrumentation.debugTool.onSetIsComposite(inlinedTextDebugID, false);
|
||||
ReactInstrumentation.debugTool.onSetDisplayName(inlinedTextDebugID, '#text');
|
||||
ReactInstrumentation.debugTool.onSetText(inlinedTextDebugID, '' + contentToUse);
|
||||
ReactInstrumentation.debugTool.onSetChildren(this._debugID, [inlinedTextDebugID]);
|
||||
}
|
||||
DOMLazyTree.queueText(lazyTree, contentToUse);
|
||||
} else if (childrenToUse != null) {
|
||||
@@ -1021,10 +1021,10 @@ ReactDOMComponent.Mixin = {
|
||||
this.updateTextContent('' + nextContent);
|
||||
if (__DEV__) {
|
||||
var inlinedTextDebugID = this._debugID + '#text';
|
||||
ReactInstrumentation.debugTool.onSetChildren(this._debugID, [inlinedTextDebugID]);
|
||||
ReactInstrumentation.debugTool.onSetIsComposite(inlinedTextDebugID, false);
|
||||
ReactInstrumentation.debugTool.onSetDisplayName(inlinedTextDebugID, '#text');
|
||||
ReactInstrumentation.debugTool.onSetText(inlinedTextDebugID, '' + nextContent);
|
||||
ReactInstrumentation.debugTool.onSetChildren(this._debugID, [inlinedTextDebugID]);
|
||||
}
|
||||
}
|
||||
} else if (nextHtml != null) {
|
||||
|
||||
Reference in New Issue
Block a user