Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,14 @@ function updateTree(

// Clone nodes before mutating them so edits don't affect them.
const getClonedNode = (id: number): CommitTreeNode => {
// $FlowFixMe[prop-missing] - recommended fix is to use object spread operator
const clonedNode = ((Object.assign(
{},
nodes.get(id),
): any): CommitTreeNode);
const existingNode = nodes.get(id);
if (existingNode == null) {
throw new Error(
`Could not clone the node: commit tree does not contain fiber "${id}". This is a bug in React DevTools.`,
);
}

const clonedNode = {...existingNode};
nodes.set(id, clonedNode);
return clonedNode;
};
Expand Down
Loading