Skip to content

Commit

Permalink
Auto-expand framework frames when one of them is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
hbenl committed Jul 9, 2024
1 parent ea84bb2 commit 5fe41d2
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export function Group({
disableContextMenu,
panel,
}: GroupProps) {
const [expanded, setExpanded] = useState(false);
const isSelectable = panel == "console";

const { contextMenu, onContextMenu } = useStackFrameContextMenu({
Expand All @@ -56,6 +55,11 @@ export function Group({
copyStackTrace,
});

const containsSelectedFrame = group.some(
frame =>
selectedFrameId?.pauseId === frame.pauseId && selectedFrameId?.frameId === frame.protocolId
);
const [expanded, setExpanded] = useState(containsSelectedFrame);
const toggleFrames = (event: React.MouseEvent) => {
event.stopPropagation();
setExpanded(prevExpanded => !prevExpanded);
Expand Down

0 comments on commit 5fe41d2

Please sign in to comment.