Skip to content

Commit

Permalink
Correctly restore ui state when selectedNodeId's parent is not in dee…
Browse files Browse the repository at this point in the history
…pestExpandedGroupNodeIds.

PiperOrigin-RevId: 689231805
  • Loading branch information
Google AI Edge authored and copybara-github committed Oct 24, 2024
1 parent 05e6223 commit 53db2e8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/ui/src/components/visualizer/webgl_renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,20 @@ export class WebglRenderer implements OnInit, OnDestroy {
);
deepestExpandedGroupNodeIds = groupNodeIds;
}
// Add the parent node of the selected node if it is not set in
// deepestExpandedGroupNodeIds.
else {
const selectedNode =
this.curModelGraph.nodesById[paneState.selectedNodeId];
const nsParentId = selectedNode?.nsParentId || '';
if (
selectedNode &&
nsParentId &&
!deepestExpandedGroupNodeIds.includes(nsParentId)
) {
deepestExpandedGroupNodeIds.push(nsParentId);
}
}
if (
paneState.selectedNodeId !== '' ||
deepestExpandedGroupNodeIds.length > 0
Expand Down

0 comments on commit 53db2e8

Please sign in to comment.