From 606e12080cd96b323abf5de6f1eda1a845d14a48 Mon Sep 17 00:00:00 2001 From: Holger Benl Date: Tue, 9 Jul 2024 13:31:36 +0200 Subject: [PATCH] Auto-expand framework frames when one of them is selected (#10606) --- .../debugger/src/components/SecondaryPanes/Frames/Group.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/devtools/client/debugger/src/components/SecondaryPanes/Frames/Group.tsx b/src/devtools/client/debugger/src/components/SecondaryPanes/Frames/Group.tsx index 66bc2262631..9315c80b33e 100644 --- a/src/devtools/client/debugger/src/components/SecondaryPanes/Frames/Group.tsx +++ b/src/devtools/client/debugger/src/components/SecondaryPanes/Frames/Group.tsx @@ -47,7 +47,6 @@ export function Group({ disableContextMenu, panel, }: GroupProps) { - const [expanded, setExpanded] = useState(false); const isSelectable = panel == "console"; const { contextMenu, onContextMenu } = useStackFrameContextMenu({ @@ -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);