Skip to content

Commit

Permalink
LogBox: Intelligently Un-Collapse Stack Frames
Browse files Browse the repository at this point in the history
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
  • Loading branch information
yungsters authored and facebook-github-bot committed Feb 9, 2021
1 parent 7f5ec15 commit 88a41f1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Libraries/LogBox/UI/LogBoxInspectorStackFrames.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ export function getCollapseMessage(
}

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

function getStackList() {
if (collapsed === true) {
Expand Down

0 comments on commit 88a41f1

Please sign in to comment.