if (oldRenderedNode == null) {
expandedPaths.clear();
return expandedPaths;
}
JsElement parentElem = oldRenderedNode.getParentElement();
// The old node may have been moved from a rendered to a non-rendered
// state (e.g., into a collapsed folder). In that case, it doesn't have a
// parent, and we're done here.
if (parentElem == null) {
expandedPaths.clear();
return expandedPaths;
}
// Make a new tree node.
newRenderedNode = createNode(incomingSubtreeData);
parentElem.insertBefore(newRenderedNode, oldRenderedNode);
// Remove the old rendered node from the tree.
oldRenderedNode.removeFromParent();
}