mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
@@ -239,15 +239,12 @@ export function attach(
|
||||
parentFiber == null ? null : getDataForFiber(parentFiber);
|
||||
const parentFiberDisplayName =
|
||||
(parentFiberData && parentFiberData.displayName) || 'null';
|
||||
// NOTE: calling getFiberID or getPrimaryFiber is unsafe here
|
||||
// because it will put them in the map. For now, we'll omit them.
|
||||
// TODO: better debugging story for this.
|
||||
console.log(
|
||||
`[renderer] %c${name} %c${getFiberID(
|
||||
getPrimaryFiber(fiber)
|
||||
)}:${fiberDisplayName} %c${
|
||||
parentFiber
|
||||
? getFiberID(getPrimaryFiber(parentFiber)) +
|
||||
':' +
|
||||
parentFiberDisplayName
|
||||
: ''
|
||||
`[renderer] %c${name} %c${fiberDisplayName} %c${
|
||||
parentFiber ? parentFiberDisplayName : ''
|
||||
}`,
|
||||
'color: red; font-weight: bold;',
|
||||
'color: blue;',
|
||||
|
||||
+18
-1
@@ -711,9 +711,17 @@ export default class Store extends EventEmitter {
|
||||
|
||||
element = ((this._idToElement.get(id): any): Element);
|
||||
parentID = element.parentID;
|
||||
|
||||
weightDelta = -element.weight;
|
||||
|
||||
if (element.children.length > 0) {
|
||||
throw new Error(
|
||||
'Fiber ' +
|
||||
id +
|
||||
' was removed before its children. ' +
|
||||
'This is a bug in React DevTools.'
|
||||
);
|
||||
}
|
||||
|
||||
this._idToElement.delete(id);
|
||||
|
||||
if (parentID === 0) {
|
||||
@@ -769,7 +777,16 @@ export default class Store extends EventEmitter {
|
||||
}
|
||||
|
||||
element = ((this._idToElement.get(id): any): Element);
|
||||
const prevChildren = element.children;
|
||||
element.children = Array.from(children);
|
||||
if (element.children.length !== prevChildren.length) {
|
||||
throw new Error(
|
||||
'Fiber ' +
|
||||
id +
|
||||
' received a different number of children on reorder. ' +
|
||||
'This is a bug in React DevTools.'
|
||||
);
|
||||
}
|
||||
|
||||
if (!element.isCollapsed) {
|
||||
const prevWeight = element.weight;
|
||||
|
||||
Reference in New Issue
Block a user