So I have a rather large tree (thousands of nodes) which defaults to expanding all branches. My expandedNodesMap has over 500 nodes in it. If I'm using this relatively early in the lifetime of my app, the scope.$id in the treeTransclude directive is less than the length of my expandedNodesMap.
Thus, when I get to the following code in that directive:
angular.forEach(scope.expandedNodesMap, function (node, id) {
if (scope.options.equality(node, scope.node)) {
scope.expandedNodesMap[scope.$id] = scope.node;
scope.expandedNodesMap[id] = undefined;
}
});
it completely overwrites an existing node in the map because scope.$id is < length of the map. This causes some very unpredictable results.