Skip to content

Commit 88a41f1

Browse files
yungstersfacebook-github-bot
authored andcommitted
LogBox: Intelligently Un-Collapse Stack Frames
Summary: Tweaks LogBox so that if all stack frames are collapsed, start off without collapsing any of them. It saves developers from one extra interaction to make the LogBox actually useful for errors where every frame is ignored. Changelog: [General][Changed] - LogBox will not initially collapse stack frames if every frame would be collapsed. Differential Revision: D26266195 fbshipit-source-id: dcdbe0834da5fc3a0bf49fb7857de30dd7e4b8cb
1 parent 7f5ec15 commit 88a41f1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Libraries/LogBox/UI/LogBoxInspectorStackFrames.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ export function getCollapseMessage(
6363
}
6464

6565
function LogBoxInspectorStackFrames(props: Props): React.Node {
66-
const [collapsed, setCollapsed] = React.useState(true);
66+
const [collapsed, setCollapsed] = React.useState(() => {
67+
// Only collapse frames initially if some frames are not collapsed.
68+
return props.log.getAvailableStack().some(({collapse}) => !collapse);
69+
});
6770

6871
function getStackList() {
6972
if (collapsed === true) {

0 commit comments

Comments
 (0)